We use VMs with snapshots as part of our support and release testing processes, which makes testing patches to client systems convenient (take snapshot, apply changes, test, revert, lather, rinse, repeat (and re-apply the updates & commit the snapshot's changes when the updates go live)), a setup that I am trying to improve.

One of the issues we have is database performance, which I am aware is always going to be bad on a snapshotted VM because of how much extra work is done for every write compared to the same write on a physical machine but I would like to improve this as much as is possible.

On physical machine we tend to split things over three separate drives (or three separate arrays as RAID1 or 10 is standard on our production boxes) when running SQL Server, as a rule-of-thumb keeping data files on one, main database log files on another, and tempdb (& the OS) on a third.

This doesn't seem to be possible with VirtualBox with snapshots as I can not find any way to split the snapshots for each drive over different locations. I can keep three vdisks on separate drives on the physical host which would make the same sort of difference were snapshots not being used, but with a snapshot all write activity (and subsequent read activity for the affected areas) is going to be concentrated on one drive as all the differencing files go to the same place. I can keep the differencing files an a separate drive to the drives holding the base vdisks containing committed activity which will no doubt help, but not as much as being able to completely separate the IO for each vdisk to different physical drives.

tl;dr: Is there a way to ask VirtualBox (or another virtualisation solution, as I may be able to consider alternatives at this point) to keep the differencing files for snapshots with the base vdisk files to which they relate, rather than them all going into one common directory? The snapshot location option is only available at the VM level, not vdisk level, doesn't seem to accept relative paths. Or are we going to be better off just keeping the VM on a 4-drive RAID0 physical volume (with backups on a much safer array, of course!)?

  • Not what you want to hear but on the off chance that someone in the future finds your question and it IS appropriate then it's worth noting that 3Par SAN kit lets you keep your original LUN and snaps on different disk types. Like I say this is not use to you but it's a pretty cool feature. – Chopper3 Jun 25 '11 at 9:09

You don`t say what your server OS for VBox is. But if you used Linux, you could put your virtual disks onto LVMs and snapshot these.

Alternatives for VirtualBox (I use VBox only on PCs, not on servers): - XEN (very good for using para-virtual linux with linux vserver os) - KVM (if you want linux as vserver) - Hyper-V (Microsoft/Microsoft)

Another alternative: Do a complete backup before testing and a complete restore after testing - no snapshotting at all.

Or: Use the snapshot to create a full clone, then remove the snapshot...

  • We are using Linux hosts, but LVM isn't really an option. The snapshots may need to persist quite some time and IIRC LVM2 snapshots can not persist between reboots. Also LVM is slow with an active snapshop as every write is "read real block, copy to snapshot block, write new real block" which is better if the snapshots are temporary (removing the snapshot is near instant) but not otherwise (this is why vbox keeps changes in the snapshot file, not original blocks like LVM). Taking full copies might be an option but some of the vdisks can be quite large so this would be time consuming. – David Spillett Aug 3 '11 at 15:40

I took a look at a .vbox-file of a DOS VM after snapshotting it:

The HardDisk-Section of that XML-file looks promising:

  <HardDisk uuid="{e3f3bbd7-1a6d-45b1-9c3b-1a22c12e97d7}"
  <HardDisk uuid="{b299df93-905b-4030-b66d-04828a194d7c}"

My guess is that you can modify the path given in "location" for the snapshot at your will (with a paused or shutdown vm). Try it...

  • I've looked at the VM definition file, but I'm wary of messing around at that level. Anything manual will be something I'll have to do for the users of the VMs who are not all that confident, and to automate it we'd have to sort out how to know which base VDI of the drives present in the VM a given snapshot VDI refers to (it doesn't seem obvious from the XML file on its own). – David Spillett Aug 10 '11 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.