Thursday, May 25, 2006

Filesystem Snapshots on Mac OS X

There, that got your attention, didn't it?
Unfortunately we're still to see a real filesystem snapshot happening on Mac OS X. Using a real filesystem, such as SolarisZFS, you have the ability create a snapshot of how a filesystem looked at a particular point in time, without having to make a copy of that whole filesystem. You can then go back to the snapshot and access it as if there had been no changes made. NTFS has a similar capability, but at the file level, called Volume Shadow Copy, which is also very handy. When Volume Shadow Copies are set up on a server, a user can right-click on a file, and view previous versions of it - or even undelete files and folders, meaning that there is less and less need to retrieve files from backup tape for simple problems like that.
Now, there was recently an article at AFP548 that detailed a method they used to hack snapshots into Mac OS X, but it's pretty fragile, and even they admit it's not really up for deploying in a production environment. While there are plenty of rumours about Apple looking at ZFS for Mac OS X, I'm not holding my breath, as it all sounds the same as the rumours a few years back about Apple looking at NTFS as the native filesystem for Mac OS X.

Anyway, there's another way to achieve similar functionality, and that's using rsync to make a duplicate of a filesystem, and to use hardlinks to do so.
Enter rsnapshot - "a filesystem snapshot utility for making backups of local and remote systems."
The version of rsync included with OS X 10.4 is apparently resource fork aware, as mentioned in it's manpage with the -E or --extended-attributes options to copy extended attributes, resource forks.
There is also another port of rsync, called rsyncX that provides a GUI for rsync, so that you can set up in an easier fashion.
Once you've got it all set up, what you then can do is make a complete copy of your filesystem to an external drive. Then you can tell rsync to make another copy, but to look at what's already there, and if a file is identical to one that's about to be copied, then rsync will make a hardlink to the existing file, taking up very little space on the target disk. This allows you do make incremental backups, that each look and behave like a full backup, but without taking up anywhere near as much disk space, as the vast majority of the files will be backed up with hardlinks and only files that have changed will be copied in their entirety.
Also, due to the way that hardlinks work, you can delete old backups, and the filesystem keeps track of how many hardlinks each file has, and will only delete the file if there are no more hardlinks pointing to it. What this means is that if you do delete an old backup, you're just deleting the files that had changed for that backup, and the hardlinks to the rest of the files, leaving the contents of the files still on disk if they are being used by other hardlinks.

Now, it is worth taking into account that all backup solutions on Mac OS X, as tested by plasticsfuture, do have particular problems that need to be taken into account, and rsync at this moment in time, doesn't copy some of the metadata associated with files - the most important one it misses is ACL (Access Control List) information, however for a copy of a personal workstation, I believe that rsync will copy enough metadata to be useful to me.

A commercial alternative, which is a native Mac OS X Cocoa application, is SuperDuper! and this seems to get the double-thumbs-up rating wherever it's reviewed. It also appears to have the ability to do do a snapshot-style backup, however it is proprietary and closed source (which doesn't, in my books, automatically make it evil). The free version will do simple backups, but if you want the extended functionality, you need to pay for it. Fair enough too...

0 Comments:

Post a Comment

<< Home