Merge snapshot on running machine? clonehd?

This is for discussing general topics about how to use VirtualBox.
Post Reply
lidocaineus
Posts: 2
Joined: 3. Dec 2009, 00:53
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux

Merge snapshot on running machine? clonehd?

Post by lidocaineus »

I'm coming from a VMware esx/esxi background so bear with me - is there no way to merge snapshots back into machines that are running? I have VirtualBox currently running on a machine with no GUI so I use the CLI exclusively. VBoxManage snapshot has an option to merge the snapshots (--discard) but it always says the machine must be stopped to merge changes in with the original. Is this true? In other words, if I snapshot a virtual machine to put the hard drive file in a steady state, copy the drive file to a backup, I can't merge the snapshot back in without shutting the virtual machine down? That seems a bit odd.

The weirder part is that you can use the VBoxManage clonehd command to dupe the drive... while the virtual machine is active. This seems awfully dangerous as the drive is in a changing state as the clone is running. Or is the clonehd command actually freezing the state of the machine while the clone is running, then unfreezing after the operation is completed? I suppose if this was the case clonehd could be used for back up purposes, though the mandatory change of UUID is really annoying (as you'd have to work around that if the guest OS uses the UUID in any way).

And also, what is the --existing switch to the clonehd command used for? It's not documented anywhere. I'm assuming it has something to do with --remember since it's on the same line in the help.
MarkCranness
Volunteer
Posts: 875
Joined: 10. Oct 2009, 06:27
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows Server 2008 R2; Ubuntu 11.04; Windows 2000 Server; Windows XP

Re: Merge snapshot on running machine? clonehd?

Post by MarkCranness »

No you cannot discard snapshots on a VM that is running.
(For live backup, the nearest I can suggest is VBoxManage controlvm --savestate (this stops the VM) followed by filesystem backup followed by startvm (which will restart using the savestate). If your filesystem supports filesystem snapshots, the downtime can be minimised.)

You can only clonehd a drive attached to a running VM when the VM has snapshots. Taking a snapshot freezes the base image file and any disk changes made afterwards are stored elsewhere. I imagine you WANT to clone the 'Current State' version of the disk, and not the frozen disk as it was when the snapshot was taken.
Snapshots are descibed here: Tutorial: All about VDIs

--existing means 'don't complain if the target file already exists; overwrite it.'
lidocaineus
Posts: 2
Joined: 3. Dec 2009, 00:53
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux

Re: Merge snapshot on running machine? clonehd?

Post by lidocaineus »

Hmmm, I suppose the first option (savestate) would work, though it would still incur downtime in the time that it would take to copy the file.

As for your second option, actually I *do* want to copy the frozen disk image. See in esx, our typical workflow is to take a virtual machine and snapshot it, then copy the now-frozen original disk over somewhere else as a backup, then delete (merge) the snapshot back into the original. This leaves no snapshots and a copied disk in a steady state. The difference is that esx/esxi can merge the deltas from a snapshot into the running original disk. If I went this route, I'd have to shut the machine down, re-merge, then start it back up.

So basically at this point VirtualBox has no online way of doing snapshot/backups and re-integrating the snapshots back into the original Hmm... I guess this reflects the more desktop oriented nature of VB vs the more server-oriented esx (ie, no downtime).
Post Reply