Home > Miscellaneous > Enable time machine backup to network drive (DNS 323)

Enable time machine backup to network drive (DNS 323)

First, enable Time Machine to use network drives:

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Follow instructions here:
http://www.horto.ca/?p=12

I created a “sparse bundle disk image” which I saved as chimera.sparsebundle with the following options:

Volume Name: “Time Machine Backups”
Filesystem: MAC OS Extended  (Case Sensitive Journaled).
Encryption : None
Partition : Single Partition GUID
Initial Size: 1 GB.
Later I resized it to my final backup disk size : 500 GB

However, for Snow Leopard, following changes apply:

(a) Name of the sparsebundle is <computer_name>.sparsebundle. eg.

[anirbans@chimera:/Users/anirbans]$ hostname
chimera

so the file name should be chimera.sparsebundle

(b) The sparse bundle image must contain a plist file: com.apple.TimeMachine.MachineID.plist

DO NOT mount the image to create the file. If your sparsebundle file is in /Volume /Backups then,

#> cd /Volumes/Backups/chimera.sparsebundle
#> vi com.apple.TimeMachine.MachineID.plist

Or

Right click the sparsebundle image and select “Show Package Contents”. In the finder window that opens, create the file using any text editor.

Contents of the file should be something like this:

<?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>VerificationDate</key>
<date>;2010-07-18T00:33:28Z</date>
<key>VerificationExtendedSkip</key>
<false/>
<key>VerificationState</key>
<integer>1</integer>
<key>com.apple.backupd.BackupMachineAddress</key>
<string>XX:XX:XX:XX:XX:XX</string>
<key>com.apple.backupd.HostUUID</key>
<string>XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX</string>
</dict>
</plist>

Get the UUID from apple menu -> About this Mac -> More Info . In the hardware tab, see Hardware UUID on the bottom right pane.
The Machine Address is the MAC address of “en0” interface.

For Snow Leopard 10.6.3 and 10.6.4 (as of this writing, 10.6.4 is the latest version of Mac OS X Snow Leopard), Apple changed the way Time Machine treats the sparse bundle files for backups. It automatically resizes the file to occupy the entire space in the hard drive partition. If you do a grep over /var/log/system.log, you’d see the following lines:

Resizing backup disk image from 476.8 GB to 1831.7 GB

As of writing this blog, there has been numerous discussions and feature enhancement posted by various people to have an option to either limit the amount of space Time Machine can use for backups or have an option to disable Time Machine from resizing the sparse image file. No “official” resolution exists as of writing.

See :

http://discussions.apple.com/thread.jspa?threadID=2383738&start=30&tstart=120
http://discussions.apple.com/thread.jspa?threadID=2510587&tstart=0

You might think that you can hack around this problem by revoking write permissions on Info.plist file present inside the sparsebundle disk image:


# chmod a-w Info.plist
# ls -l
-rwxrwxrwx    1 anirbans anihome       499 Jul 18 13:02 Info.bckup
-r-xr-xr-x    1 anirbans anihome       499 Jul 18 13:02 Info.plist
drwxrwxrwx    2 anirbans anihome      4096 Jul 18 13:03 bands
-rwxrwxrwx    1 anirbans anihome       532 Jul 18 12:02 com.apple.TimeMachine.MachineID.plist
-rwxrwxrwx    1 anirbans anihome         0 Jul 18 13:00 token

However, you need to change the ownership of the file to some user other than the one Time Machine uses to log in to your NAS. Otherwise, Time Machine intelligently reinstates the write permissions for the file.

In my case, Time Machine uses the user name anirbans to log in. Hence, I changed the ownership of the file to root and revoked write permissions for all others.


# chown root Info.plist
# chgrp root Info.plist
# chmod o-w Info.plist
# ls -l
-rwxrwxrwx 1 anirbans anihome 499 Jul 18 13:02 Info.bckup
-rwxrwxr-x 1 root root 499 Jul 18 13:02 Info.plist
drwxrwxrwx 3 anirbans anihome 4096 Jul 19 18:35 bands
-rwxrwxrwx 1 anirbans anihome 532 Jul 19 18:35 com.apple.TimeMachine.MachineID.plist
-rwxrwxrwx 1 anirbans anihome 0 Jul 18 13:00 token

Check the logs:

Jul 18 20:05:26 chimera com.apple.backupd[2788]: Resizing backup disk image from 476.8 GB to 1831.7 GB
Jul 18 20:05:45 chimera com.apple.backupd[2788]: Could not resize backup disk image (DIHLResizeImage returned 13)
Jul 18 20:05:48 chimera com.apple.backupd[2788]: QUICKCHECK ONLY; FILESYSTEM CLEAN
Jul 18 20:05:50 chimera com.apple.backupd[2788]: Disk image /Volumes/FileServerVolume-1/chimera.sparsebundle mounted at: /Volumes/Time Machine Backups
Jul 18 20:05:50 chimera com.apple.backupd[2788]: Backing up to: /Volumes/Time Machine Backups/Backups.backupdb
Jul 18 20:05:52 chimera com.apple.backupd[2788]: Backup content size: 112.4 GB excluded items size: 7.8 GB for volume My Mac Disk
Jul 18 20:05:52 chimera com.apple.backupd[2788]: No pre-backup thinning needed: 125.43 GB requested (including padding), 476.10 GB available

As you can see, Time Machine uses just the amount of disk space allocated for the sparse bundle.

Notes:

  1. As a side note, the following does not work:
    defaults write /Library/Preferences/com.apple.TimeMachine MaxSize nnn
  2. Locking the file using something like this:
    SetFile -a L Info.plist
    might work. But somehow it did not work for me and I did not spend any time digging on it.
  3. I did enable AFP (http://en.wikipedia.org/wiki/Apple_Filing_Protocol) in my DNS323, so it backs up over AFP. Instructions on how to enable AFP is here: http://wiki.dns323.info/howto:appletalk
Advertisements
Categories: Miscellaneous
  1. Ed
    August 27, 2010 at 8:42 AM

    Is this fully working and have no problems? I read that these sparseimage files just get larger and larger (but perhaps this problem has been solved). Also, do you think your solution will have to be tweaked with future upgrades to OS X?

    http://www.flokru.org/2008/03/15/time-machine-backups-on-network-shares-2-possible-problems/

    • August 29, 2010 at 4:48 AM

      yes, it’s fully working with no issues. The sparse image will only get as much bigger as the size you specify when you initially created it. Thereafter, since I disabled write privileges on the property plist file, timemachine won’t be able to make any changes to it’s size. Yes, my solution would probably require tweaking when a new update of the OS is released.

      Thanks for reading the blog.

  2. Tasmin
    December 29, 2010 at 4:31 PM

    Hey, I tried this but for some reason time machine makes a “name 1.tmp.sparsebundle” next to the sparse bundle that I put on the network drive… and fails. It gives me the error “The backup disk image “/Volumes/etc/name 1.tmp.sparsebundle” could not be created (error 1).”

    Any idea what I’m missing? I tried taking the contents out of the temporary sparse bundle that time machine makes just before it gives up and putting it into the one I made, but that doesn’t work either. I’m running Snow Leopard, but there didn’t seem to be a com.apple.TimeMachine.MachineID.plist file in the temp sparse bundle…

    Thanks,
    Tasmin

    • December 29, 2010 at 5:10 PM

      Not sure. I need to see the backupdb logs.

  3. Tasmin
    December 30, 2010 at 2:43 AM

    Thank you for you speedy reply! I’m sorry, where can I find such a log?

  4. Tasmin
    December 30, 2010 at 2:50 AM

    Here’s a chunk from what I found in the console:

    30/12/2010 00:30:38 com.apple.backupd[1604] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 00:30:38 com.apple.backupd[1604] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 00:30:38 com.apple.backupd[1604] mount_hfs: Device not configured
    30/12/2010 00:47:58 com.apple.launchd[1] (com.apple.suhelperd[1893]) Exited with exit code: 2
    30/12/2010 01:02:56 com.apple.launchd[1] (com.apple.netauth.sysagent[1989]) Exited with exit code: 255
    30/12/2010 01:05:12 com.apple.backupd[1982] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 01:05:12 com.apple.backupd[1982] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 01:05:12 com.apple.backupd[1982] mount_hfs: Device not configured
    30/12/2010 01:12:31 com.apple.launchd[1] (com.apple.netauth.sysagent[2056]) Exited with exit code: 255
    30/12/2010 01:15:15 com.apple.backupd[2054] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 01:15:15 com.apple.backupd[2054] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 01:15:15 com.apple.backupd[2054] mount_hfs: Device not configured
    30/12/2010 01:15:31 com.apple.launchd.peruser.501[168] (com.apple.Finder[174]) Job appears to have crashed: Segmentation fault
    30/12/2010 01:15:37 ReportCrash[2084] Saved crash report for Finder[174] version 10.6.6 (10.6.6) to /Users/Tasmin/Library/Logs/DiagnosticReports/Finder_2010-12-30-011537_localhost.crash
    30/12/2010 01:19:37 com.apple.launchd[1] (com.apple.netauth.sysagent[2111]) Exited with exit code: 255
    30/12/2010 01:20:56 com.apple.backupd[2110] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 01:20:56 com.apple.backupd[2110] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 01:20:56 com.apple.backupd[2110] mount_hfs: Device not configured
    30/12/2010 01:22:33 com.apple.launchd[1] (com.apple.netauth.sysagent[2145]) Exited with exit code: 255
    30/12/2010 01:26:04 SystemUIServer[173] It does not make sense to draw an image when [NSGraphicsContext currentContext] is nil. This is a programming error. Break on _NSWarnForDrawingImageWithNoCurrentContext to debug. This will be logged only once. This may break in the future.
    30/12/2010 01:26:35 com.apple.backupd[2110] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 01:26:35 com.apple.backupd[2110] GetMasterBlock: Error 6 from read; amount=-1, wanted=512
    30/12/2010 01:26:35 com.apple.backupd[2110] mount_hfs: Device not configured

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: