Using a ZFS filesystem with Time Machine


This simple how-to explains how to get your Time Machine backups working with a ZFS filesystem. This allows you to use the features of ZFS filesystems for your Time Machine backups.

Please note this is for Mac OS X – Snow Leopard.

1) Enable unsupported network volumes on your Mac by opening a Terminal and pasting this:

greg@macbook:~ %> defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

2) Create a new ZFS filesystem and enable CIFS access to it:

greg@opensolaris:~ %> zfs create tank/userbackups
greg@opensolaris:~ %> zfs set sharesmb=on tank/userbackups
greg@opensolaris:~ %> zfs set sharesmb=name=userbackups tank/userbackups
greg@opensolaris:~ %> zfs set aclmode=passthrough tank/userbackups
greg@opensolaris:~ %> zfs set aclinherit=passthrough tank/userbackups

You will probably want to setup the correct permissions on your new share, more details in [this post].

3) Make sure you can mount this share and write to it from your Mac.

4) Create the correct disk image:

greg@macbook:~ %> /bin/bash
greg@macbook:~ %> cd /Volumes/userbackups
greg@macbook:~ %> SYSNAME=`scutil --get ComputerName`
greg@macbook:~ %> hdiutil create -size 600G -fs HFS+J \
> -volname 'Time Machine Backups' -type SPARSEBUNDLE "${SYSNAME}.sparsebundle"
greg@macbook:~ %> UUID=`system_profiler | grep 'Hardware UUID' | awk '{print $3}'`
greg@macbook:~ %> cat << EOF > "${SYSNAME}.sparsebundle"/com.apple.TimeMachine.MachineID.plist
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
> <plist version="1.0">
> <dict>
>         <key>com.apple.backupd.HostUUID</key>
>         <string>$UUID</string>
> </dict>
> </plist>
> EOF
greg@macbook:~ %>

5) and finally, open up Time Machine. You should now see your network share as an option. Choose it, configure any excludes you want and kick off your first backup!

I’ll post a little later on restoring these backups using one of these methods:

  • Restore from Time Machine by using the boot disk
  • or by doing a standard install then using the Migration Assistant.

Good luck!

, ,

  1. #1 by Stuart on November 3, 2010 - 1:48 pm

    Hi,

    This is great. One question though, is there any reason to use cifs rather than nfs? I have nfs working sharing files between macs and freebsd zfs pool.

  2. #2 by Greg on November 5, 2010 - 5:33 am

    Hi Stuart,

    No particular reason, I just find CIFS support to be quite good in OpenSolaris – it also natively ties into their ACLs. Also, I have a number of other shares around for a few windows machines on the network.

    I haven’t tested NFS at all. OpenSolaris has pretty decent NFSv4 support, but I am not sure about the state of FreeBSDs NFS support. The last time I really used FreeBSD was around 6.x, before ZFS had even been ported across.

    Your NFS setup sounds like it’s working fine though, so I’d say go for it and follow steps 1,3-5 above (/Volumes/userbackups would obviously be your NFS mounted volume instead).

    I’d really appreciate it if you drop a comment here letting me know how it went!

(will not be published)