Wednesday, February 6, 2008

Sparse Bundle Disk Images

So i've blogged in the past about my concerns on Time Machine and FileVault and how I use encrypted disk images to store sensitive data rather than use FileVault. Basically Time Machine requires you to be logged out and FileVault encrypts too much anyway.

OSX Leopard introduced Sparse Disk Bundles which I hadn't looked into until recently. Like a sparse disk image they look like a certain size volume but only use whatever capacity you've actually used within them (give or take a bit). The issue with sparse disk images is that when you change anything inside of them the entire image changes due to the encryption and you have to back it up as one big chunk. With sparse disk bundles only a small chunk (min of 8MB) that changed needs to be backed up. 

So rather than a nightly 15 minute backup of some large .sparseimage, you can get down to a nightly 30 second incremental backup of the same data in a .sparsebundle. With the same level of protection. This works both for rsync and for Time Machine.

This means if you have sparse disk images of any size you should consider converting them to bundles. Here's the command line way to convert them:

hdiutil convert -format UDSB -o docs.sparsebundle docs.sparseimage

And then when you feel comfortable (or trust Time Machine) delete the docs.sparseimage file.

Your backups will be faster and you wont eat up all your TimeMachine disk space.

And since you're mounting/unmounting these as you need them you're essentially satisfying the "logout" requirement for TimeMachine to backup the sparse disk bundles.

There's evidently some debate as to whether its safe to rsync/backup a mounted sparse bundle. From above it seems Apple thinks not.