Saturday, September 12, 2009

Snow Leopard and Time Machine over NFS

Ok, admittedly, I muck around with my systems more than strictly necessary (those that know me are guffawing at how much I'm understating this tendency), but I was having some issues getting Snow Leopard's Time Machine to continue backing up to my OpenSolaris file server over an NFS mount. My first problem was that I had somehow lost my NFS config on the OpenSolaris box. May have been due to a recent zpool upgrade, or due to the fact that I had recently completely destroyed and re-created that pool. In any case, I hadn't noticed this for a while because my NFS mounts were still working as expected for my average usage. After recreating the NFS share info (including the ability for root users on my MBP to be mapped as such on my file server), Time Machine got a bit further along. But now, it seemed to be complaining that it didn't have enough room on the backup drive. I hastily destroyed the old sparsebundle thinking that it a fresh start with a new image would work fine. When trying to backup with no sparsebundle available on the server, it gave the expected error due to being unable to create a sparsebundle directly on an NFS share. I still don't know why that's the case, but I remembered doing the same the previous time I set it up, and just created a sparsebundle locally then copied it to the server.
sudo hdiutil create -size 200g -type SPARSEBUNDLE -nospotlight -volname "Time Machine" -fs "Case-sensitive Journaled HFS+" -verbose /tmp/MACHINENAME.sparsebundle
Unfortunately, now when it tried to connect, I still saw TM attempting to create a new bundle. Not sure why, I decided to poke around backupd with dtrace for a bit to see what it was doing on the file system.

#!/usr/sbin/dtrace -s
syscall::open:entry
/execname=="backupd"/
{
 printf("UID %d: Opening file: %s.\n", uid, copyinstr(arg0));
}

syscall::open:return
/execname=="backupd"/
{
 printf("UID %d: Opening file returned: %d.\n", uid, arg0);
}

Turns out, TM was trying to read a file called com.apple.TimeMachine.MachineID.plist from within the sparsebundle directory (not the mounted image, just the directory). Some searching for that file name brought me to this page where they had the following as the suggested content for that file:
<?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>YOURUUIDHERE</string>
</dict>
</plist>
After dutifully replacing YOURUUIDHERE with my machine's UUID (pulled from System Profiler -> Hardware), Time Machine finally mounted my sparsebundle as requested and started the backup.

2 comments:

FC said...

Thanks! My TM start to work now.
My environment is Macbook Pro (snow)
and Promise NS4300 NAS. Most solutions
about this condition are not complete,
only yours help me to get it done.
Thanks a lot.

Wayne said...

Could you share your exportfs settings for your OpenSolaris NFS export please? My Time Machine is still complaining that I don't have the nexessary read, write and append privileges on the network disk.

Thanks,

Wayne