Wednesday 6 December 2017

Time machine friendly virtual machine (VirtualBox) image files?


I have a Windows 7 VirtualBox virtual machine. The disk image file is 30GB and is one large .vdi file. If I change anything inside that (even a few KBs), Time Machine wants to backup the entire 30GB file each time. Actually even if I just boot up the virtual machine, Windows makes some registry changes etc and even with 0 user/application level changes it triggers the full 30GB copy.


Is there a way to make a virtual disk image such that it's Time Machine friendly? So if a few KBs/MBs are changed, only those sectors are copied over?


Thanks Sid



Answer



After some tinkering around, it seems VirtualBox allows you to create the virtual hard drive as VMDK files (native format of VMWare). VMDK files allow you to split the total image into 2GB chunks, so a 30GB hard drive is actually 16 files



  • 1x Meta file (text file listing all the actual files) ~few KB

  • 15x 2GB VMDK chunk files (the actual virtual disk)


I've yet to hook up Time Machine to see how friendly this makes it, but I think this might actually work.


[Update #1] This is certainly quite useful! I no longer face a full copy of a 30GB image, the backup is about 3-4 GBs (because multiple chunks are updated on each bootup). One change I'd do if I were starting over again, I'd might make each chunk/slice about 200MB each so that (worst case) when any file is updated, 200MB is to be updated instead of 2GB.


[Update #2] I brought this up on the VirtualBox developer forums and it seems that the VMDK spec defined by VMWare (and used by everyone else, including Oracle VirtualBox) is hardcoded at 2GB chunks. So there is absolutely no flexibility to drop chunk size down to 1GB/500MB or 200MB.


Also, unlike the simple bootup tests I had done before, I've since noticed that if I do anything useful inside the Windows 7 VM, Time Machine's backup size goes to 10-15GB! Somehow a LOT more chunks are being hit even if I write little data (I suspect fragmentation of files across many chunks + swap file)


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...