A safe way to back up a sparsebundle that is exported via afpd

backupdata integritymac-osxrsnapshottime-machine

I work with a number of OSX client machines that back up via TimeMachine to AFP shares on an Ubuntu Linux file server, exported by netatalk/afpd. These clients back up at arbitrary times of the day, every day. There are other important non-TimeMachine AFP shares on the server also.

On the server, the TimeMachine backups are represented as sparsebundles – a data storage format involving many 'bands' – stored on the standard EXT4 filesystem. Buried within this sparsebundle is a disk image with the HFS+ filesystem that TimeMachine uses, but from the server side it is just a collection of band files and some top-level metadata.

rsnapshot runs every 4 hours on the server and backs up the sparsebundle band files & metadata onto removable media (for off-site storage). Therefore rsnapshot is also backing up these sparsebundle bands at arbitrary times of the day. rsnapshot uses rsync to perform the copying.

The problem is that if rsnapshot runs while a client machine has its sparsebundle mounted, I am concerned that it is possible for rsnapshot to capture an inconsistent state of the sparsebundle because the bands may change during the backup process. Clearly this is not conducive to guaranteeing a restorable backup!

I'm trying to think of ways to work around this problem. It seems important that the sparsebundle is not mounted at the time rsnapshot tries to do the backup. From the server side, the only way I can presently see to do this is to take down the aftp daemon, perhaps after waiting for the sparsebundle to be unmounted by the OSX client. The downside of this is that it also takes the other non-TimeMachine AFP exports offline also, and this is unacceptable to the users. As far as I can tell, afpd doesn't provide a way to (easily) add or remove exports – although one option may be some automated rewriting of afpd's config files to disable the TM exports during the rsnapshot backup, but this still takes down the AFP shares for a short time.

Is there a better way?

Best Answer

I'd avoid Time Machine for a group of Mac computers. Far too many issues with the sparse bundles and corruption of the backups.

When presented with a similar situation, I went with CrashPlan after finding the Time Machine approach unsuitable for production.

Backup strategy for developer-focused Apple environments?

Related Topic