Using Time Machine with Virtualization (Parallels, VirtualBox, VMWare, etc...)
Since a single small change to a VM file should (I think) cause the entire multi-gigabyte file to be backed up again, are there any ideas I can use to more effectively backup my machine?
Assume that I only need one copy of a VM, and changes made to the VM don't matter.
For example:
Backup the VM using time machine once, then exclude the folder that contains all the VMs
Exclude the VM's altogether and manually back up the VMs
Let Apple's software do it's thing, it will be effective at managing the disk space
Parallels has a specific setting to optimize its VMs for backup by Time Machine and prevent backing up unchanged data.
To enable improved integration with Time Machine, please go to Virtual Machine Configuration, choose Options and hit Backup.
Select "Optimize for Time Machine" in SmartGuard menu.
Similarly, VMWare Fusion has some support for Time Machine, which appears to involve turning on snapshots.
"... I store all of my virtual machines on a sparsebundle disk image. This is a mounted filesystem that seamlessly breaks up the filesystem into many 8MB files. That level of granularity keeps my TM backups small. For example, I have three individual VMs stored on a single sparsebundle volume. They currently occupy 3012 individual 8MB "bundle" files. The last time I used those VMs, I ran software updates on all of them. A total of 118 of those 8MB files changed as a result of the updates, so the TM backup was 944MB. If they were not on a sparsebundle volume, the TM backup would have been about 24GB.
I use Parallels, but the same concept should apply to any application that creates and frequently updates very large files. Use Disk Utility to create the sparsebundle volume."
Source: Apple Support Communities by Pondini
Enable snapshots. In VMWare when a snapshot is created, the (VMDK) hard drive contents are frozen, while changes are stored as a separate delta.
Before: 20GB VMDK + 1GB of changes = 20GB of changed files to backup
After 20GB VMDK (Snapshotted) + 1GB of changes = 1GB of changes to backup.
Additionally, you can keep snapshotting, so if you have an initial 20gb Snapshot1 + 2gb of deltas, each incremental backup would be 2gb.
Once you take a second snapshot, you end up with 22gb frozen. 20GB for S1, 2GB for S2, and then you just need to backup the next deltas.
The only downsides are:
- It takes more physical space. 20GB frozen image + 2gb of deltas take a total of 22gb of storage.
- It's not possible to shrink snapshotted VMs, so make sure to pre-shrink before taking the snapshot.
Since you say "changes made to the VM don't matter" then you can do what I do which is
- Put all the VMs in one folder
- Exclude the folder with the VMs from Time Machine
- Manually back up the VM folder. I keep a copy offsite on a portable RAID 1 drive.
Letting Time Machine "do its thing" is a bad idea, as it will make a new copy every it does a backup, which is generally around once an hour. You will eat up all your storage space very quickly and it will be pointless anyway.
You could "backup the VM using time machine once, then exclude the folder that contains all the VMs" but the Time Machine interface is not the best for retrieving your saved copy in that situation, plus Time Machine will delete old files if it needs to in order to save space and you don't know when it will delete your one and only backup copy of your VM.
By doing a manual backup of your VMs you can also refresh them once in a while (say when new guest OS updates are applied) much more easily than with a Time Machine solution.
Snapshots affect performance quite a bit unless the snapshot and the virtual disk is on a high-performance solid-state drive. It is worth considering if you need regular backups of ongoing work on the VM, but since you say you don't care about changes to the VM then snapshots are best avoided altogether.