Using NFS for a Time Machine disk.
This is a compilation of several posts I found while researching this procedure and I wanted to save the steps. I’m sure I’ll need them again.
My “MAC” is running 10.10.5 and the NFS server is Ubuntu Linux 14.04 with ZOL.
Set up the server first.
- Create a new zfs file system
% sudo zfs create tank/home/tom/timemachine
- Ensure it’s NFS shared
% sudo vi /etc/exports && exportfs -a
Now, on to the “MAC” after mounting the NFS share.
- Create the sparse disk image.
% hdiutil create -size 500g -type SPARSEBUNDLE -fs "HFS+J" -volname "Time Machine" \ /net/NFS-SERVER/home/tom/timemachine/time-machine.sparsebundle
- Mount the “disk”
% open /net/NFS-SERVER/home/tom/timemachine/time-machine.sparsebundle
- Tell Time Machine to use this volume
% sudo tmutil setdestination "/Volumes/Time Machine"
The default zfs compression is lz4 and it does a decent job.
$ sudo zfs get compression,compressratio,used,logicalused tank/home/tom/timemachine NAME PROPERTY VALUE SOURCE tank/home/tom/timemachine compression lz4 inherited from tank tank/home/tom/timemachine compressratio 1.76x - tank/home/tom/timemachine used 117G - tank/home/tom/timemachine logicalused 203G -
The “MAC” thinks it’s used a bit more.
$ df -h /Volumes/Time\ Machine Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/disk5s2 500Gi 212Gi 288Gi 43% 55487494 75500526 42% /Volumes/Time Machine
One closing note… My testing has shown it’s easy to damage the disk image by rebooting the “MAC” whilst the disk is open. I’d suggest ejecting the disk prior to rebooting to prevent this.