Tip: Use NFS instead of Samba for Time Machine Backups
I recently converted my Time Machine backup to use NFS instead of Samba. All in all, it was a pretty simple procedure. By using NFS, I dropped userspace CPU usage from a maximum of 40% with Samba to no more than 7-8% with NFS. This is on an AMD 4800+ X2, so the performance gains will be even bigger on slower machines. This means that my media server can now play HDTV h264 files without lagging during backups - a huge win for the elusive "WAF"!
A few notes about OS X and Time Machine compatibility:
- Enable the 'insecure' option on the NFS share, as OS X will use non-privlidged ports to connect.
- Use the anonuid and anonguid parameters as I don't have the same UID mappings on my laptop.
- Mount the NFS share via the Finder. This is better than using Directory Services to automount the share, as you will get a proper icon in the Finder with this method. Time Machine is smart enough to mount the NFS share if needed during a backup, and unmount it when done.
- Open Time Machine, and choose the new share as your target disk. Backups will resume as if nothing has changed!
This worked fine for a few days, until I accidentally knocked out my network cable during a backup. This caused my disk image to become slightly corrupted and irrepairable by Disk Utility. It still worked, but I didn't want to risk further corruption. Unfortunately, OS X didn't seem to want to create a new backup image via NFS. With Samba, it will initialize all of the appropriate files to mark the share as a Time Machine backup, but fail when creating the image. NFS didn't even get that far. So, I mounted the share with Samba, stopped it as soon as it started "Preparing backup...", and then re-pointed with NFS.
The first backup took nearly 2 days for 50 GB of data. There was no real load on the network, the client, or the server, but Time Machine is usually pretty slow the first time even with a normal hard drive. Subsequent backups take around 10-20 minutes, which is pretty reasonable.