backing up VirtualBox

Joseph Sinclair plug-discussion at stcaz.net
Fri Jun 19 22:55:52 MST 2009


I assume you're using VDI disk images for the Virtual Machines.  If you're using write-through disks it gets a LOT harder.

With VDI disks:

VBoxManage snapshot <VMachine name or UUID> take backup-$(date +%Y%M%DT%H%m%s) --description "backup for $(date +'%Y-%M-%DT%H:%m:%s %z')"

Then backup the newly created snapshot VDI file (along with any previous snapshots as well, of course; rsync is a great tool here).  Restoration requires ALL snapshots from first to last, so don't discard any VDI files.
The most recent VDI is always the current running state, and you need to leave that one off the list, since it's generally not safe to use for backup and restore.

This will correctly snapshot the state of a *running* VM and allow you to backup it's VDI file(s) for later restoration if needed.
You can restore the VM by simply restoring the VDI file(s) for that machine, and starting it up.

The one downside of this is that you can end up with a LOT of snapshot VDI files.  That's no big deal for VBox, but it's good to discard (with VBoxManage snapshot discard [machine] [snapshot name], start from the oldest and move forward) all of the old snapshots during any planned downtimes to keep the filecount manageable.

der.hans wrote:
> moin moin,
> 
> what are good ways to implement backups of VirtualBox VMen?
> 
> I'm mostly worried about the active servers. We need to be able to do bare
> metal recovery in order to get the servces back up as well as getting
> incremental changes.
> 
> We will also have some development VMen, but they're not that important.
> 
> ciao,
> 
> der.hans


More information about the PLUG-discuss mailing list