Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a virtual machine with about 30 snapshots in branches. The current development path is 22 snapshots plus the base disk. The amount of files is seemingly having an impact now on IO and the dev laptop I'm using (don't know if it is host disk performance issues with the 140GB total size over a lot of fragments, or just the fact that it is hitting sectors distributed across a lot of files).

I would like to merge the current development branch of snapshots together with the base disk, but I am unsure if the following command would produce the correct outcome. I am not able to boot this disk after the procedure completes (5-6 hours).

vboxmanage clonehd "C:\VPC-Storage\.VirtualBox\Machines\CRM\Snapshots\{245b27ac-e658-470a-b978-8e62137c33b1}.vhd" "E:\crm-20100624.vhd" --format VHD --type normal

Could anyone confirm if this is the correct approach or not?

share|improve this question
To add some information, the error I am getting is not a VirtualBox error, but a boot error from Windows. It wants to launch startup repair, but as I don't know the error, I don't know the fix. Starting windows normally results in a long wait and a blue screen. Is this expected or have I used the wrong method when cloning the disk? – Henrik Jun 24 '10 at 11:15
I've used VBoxManage (on Windows host, Ubuntu guest) as you've suggested in your question and it did properly merge the snapshots into the single output disk image – Chaulky Dec 6 '12 at 4:13
Yes this is a correct approach. It's better to specify just the source UUID instead of its file name, then you're sure VBox will be able to resolve the attachments. – rustyx Mar 30 '13 at 14:55
up vote 6 down vote accepted

What you want to do is from the snapshots dialog, select your parent snapshot that you want to merge all snapshots afterwards to a single VDI.

From your description it sounds like this is the root of the tree.

Right click and select 'Delete Snapshot'.

This will do what you want --- it will merge all the changes from all child snapshots into a single VDI.

Additionally - cloning the disk image that is in the latest snapshot - will also merge the differencing disk with its parent (and its parent, so on, until you get to a 'normal' hard disk type).

I suspect that 'deleting a snapshot' runs the clonehd command.

Check your VM settings (specifically IO APIC enabled/disabled) and make sure they match.

share|improve this answer
I guess this is currently the only way to do this, however it is a manual, time consuming, multi click in GUI way to do it. – Henrik Aug 27 '10 at 13:50

If you only want to keep a single snaphot, make it your current state & then export the VM & re-import it. Exported appliances don't retain their snapshot history.

Or you could use this script to handle the merging for you. Given the number of snapshots you have, I would expect the export/import cycle to be quicker.

share|improve this answer

Here's a technique (tested on VirtualBox 4.3.4) that uses the 'Clone' command to merge and compact all the snapshots to a new VM containing a single VDI file:

  1. Rename the VM so you can reuse its current name for cloned VM (you can change the VM name from the 'Basic' tab of the 'General' settings).

  2. Right-click on the VM and run the 'Clone...' command:

    • Set the name to the VM's original name.
    • Accept the remaining defaults i.e. Clone type: 'Full clone'; Snapshots: 'Current machine state'.
  3. Delete the old VM (right-click on the VM and run the 'Remove...' command).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .