2010/10/14

Using (unsupported) SMB shares for Time Machine

Yesterday, after setting up my Samba NAS based on a dual-Atom MSI Wind Box, I fought against Time Machine, which refuses to use a shared folder as a backup disk.

So after a long struggle, I found this forum post which make everything work.

DISCLAIMER: this use of Time Machine will be unsupported by Apple, so use it at your own risk, warranty is void, and so on.

Terminal access is required.



These are the basic steps, with comments on my own:

1. Make your storage "compatible" with Time Machine.

Create an empty file in the root of the storage, using "touch .com.apple.timemachine.supported". Note that by beginning with a dot, the file will be hidden in OSX and in linux, but not in windows.

2. Create the disk image that will be used for the backup

On your Mac, create a sparse bundle image called Computername_macaddress.sparsebundle (ie, Applecore_002500d1c6f0.sparsebundle) using Disk Utility. It should have a name of "Backup of Computername". The size should be the maximum size the sparsebundle can grow to on whatever linux filesystem it is going to live on. Set the filesystem type appropriately for your Mac "MacOS Extended Case in/Sensitive (Journaled)". Image format should be "sparse bundle disk image". Then create the file.

If you need to know the macaddress, remember that you need the mac address of the ethernet port, even if you are going to backup via wireless. I don't know what to do on the macbook air. Usually the command "ifconfig -a" is enough to read the macaddress.

3. Make the disk image compatibile with Time Machine

Mount the image you just created in the finder, cd into it in the terminal (it gets mounted on /Volumes/Backup of Computername) and issue the "touch .com.apple.timemachine.supported" command.

4. Unmount the image

Ejecting it in the finder is the quickest option

5. Connect the share in the finder and copy the image there

Use the "Connect to server" in the finder to open the share, and save the password. Then copy the empty image you created in the server.

6. Review the permissions of the copied image on the server

If you are using a samba share on linux, make sure the uploaded file have the right permissions. For a test I would issue a "chmod 666" on it.

7. Make Time Machine use the share

Open Time Machine preferences, and select a disk to to a backup. You should find the disk you connected earlier. Start a backup.

Troubleshooting

If you encounter issues, try to double check image and share permissions, Time Machine has a bad habit of creating files as the root user.

If the image got corrupted, try to check it with the disk utility. If the disk utility finds any error and correct them, it may change the disk image size. If it's the case, simply set a new image size using disk utility itself and wait for the operation completion.

As usual, this post instructions are at "works for me"(tm) status. :)

No comments:

Post a Comment