Enable Time Machine for Samba shares

September 25, 2009

Don't feel like shelling out the cash for a Time Capsule? Use Time Machine to backup your data on a local Samba share instead.

Create the sparsebundle image

hdiutil create -size $SIZEg -fs HFS+J -type SPARSEBUNDLE -volname "Backup of $HOSTNAME" $HOSTNAME_$MACADDRESS.sparsebundle

Copy to share

cp -r ./$HOSTNAME_$MACADDRESS.sparsebundle /Volumes/share

Enable unsupported volumes

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Ensure that the backup location is mounted after running the above command. Open the Time Machine preferences and you can now choose the network share as a backup point.

Snow Leopard

If you are running OS X 10.6, the following steps must be completed before this will work.

cd /Volumes/share/$hostname.sparsebundle
vim com.apple.TimeMachine.MachineID.plist

Paste the following:

<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>

$UUID can be found in System Profiler.