Apple Time Machine + FreeBSD in 14 steps.

So, here’s a quick howto on how to setup Time Machine on Mac OS X so that it backups to a networked machine running FreeBSD. 

On the FreeBSD machine:

  1. Build & Install net/netatalk from ports.
  2. Edit /usr/local/etc/AppleVolumes.default
  3. Append: “/your_time_machine_path TimeMachine allow:your_user_name cnidscheme:cdb options:usedots” and replace your path and your username in the proper places.
  4. Optionally, remove the “~” already present in that file if you don’t want to share users home directories.
  5. Add “netatalk_enable=”YES”" and “afpd_enable=”YES”" to /etc/rc.conf.
  6. /usr/local/etc/rc.d/netatalk start (nothing will be printed).

On the Mac OS X machine (running Leopard, of course):

  1. Mount your remote volume. Command+K on the Finder and then type: “afp://<machine IP address or local hostname if you have a local DNS server>”. You can’t type the machine name because we’re not using multicast DNS.
  2. Build a sparse bundle image using “Disk utility” (HFS+ case-sensitive formatted). Usually, the size should be something that gives you enough room for expansion. If you want to backup your whole MacBook/iMac/etc. disk, you can set the sparse bundle image size the same as the disk your are backing up.
  3. The name of this image is important. It should be “Your_Computer_Name_MACAddress.sparsebundle”. Check your computer name from the “Sharing” section of “System Preferences” and the MAC address comes from the interface you’ll be using to do the backup. I really recommend using your Wired interface. Check the MAC address via ifconfig(1) or via the “Network”  section of “System Preferences”. E.g., if you’re John Doe, have a MacBook and your MAC address is 00:01:02:03:04:05, your file should be named “John Doe’s MacBook_000102030405.sparsebundle”.
  4. On the Terminal, type “defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1″. This is the crucial thing.
  5. Go to “System Preferences”, “Time Machine” and enable it. The networked volume will now show up on the list.
  6. Before selecting the volume on which you’ll dump the backup, copy the sparse bundle file you’ve created to your networked volume called “TimeMachine”.
  7. Select the networked Volume from the Time Machine volumes list.
  8. Initiate the backup!

Enjoy!

EDIT: As Remko points out in the comments, the MAC address is not restrictive. So, if you want to backup via wired interface and after that via wireless, Time Machine will work using both interfaces. I suppose that Time Machine inspects all MAC addresses in your machine and then searches a sparse bundle in the networked volume that matches.

16 thoughts on “Apple Time Machine + FreeBSD in 14 steps.

  1. Great work Rui! This should and would really help people to get this straight!

    Note that I did the same setup a month or two ago and that I initiated it via the wired setup and now do periodic backup via wifi, i didn’t need to alter the mac address name or anything.

    Cheers
    remko

  2. Pingback: The Shout of Horus Lee

  3. Pingback: grUNIX

  4. Pingback: Utiliser “Time Machine” de Apple avec FreeBSD at FreeBSD-fr: Les nouvelles du géant en français

  5. Good job!

    Just curious: why use netatalk instead of samba?

    Next up: try using an encrypted disk image for backup security. I think I saw a how-to on macosxhints.com.

  6. Pingback: links for 2008-10-07 « /home/servrrockr

  7. Matt, first of all, thanks.
    Now, to reply to your questions. Samba is slow for me. I can’t get it to cross 10MB/s on my gigabit network. afpd was quick to reach the disks’s peak speed (40MB/s), so I gave up on Samba.
    I agree that backing up to encrypted storage would be nice, but FreeBSD already comes with a nice man page describing the process (geom_eli(4)).

    Regards,
    Rui Paulo

  8. Pingback: Apple Time Machine + FreeBSD in 14 steps | FreeBSD - the unknown Giant

  9. Just wanted to add a couple things.

    1) DO NOT TRY TO CREATE THE DISKIMAGE OVER THE NETWORK. I spent a lot of time trying to figure out why I was getting errors and it turns out to be a known bug.

    2) When you select a format for your diskimage, leave it on APM. Timemachine would not write to a GUID diskimage.

    Thanks so much Rui, I now have time machine making backups to a zfs pool!

  10. Pingback: Websites tagged "howto" on Postsaver

  11. Re: encryption. No need to encrypt the disk image. Just use FreeBSD to encrypt the FBSD volume / disk. Much easier.

  12. Pingback: jaimerios.com » Blog Archive » FreeBSD and TimeMachine

  13. I guess I need to build the sparse image locally and then upload it to the share. Disk Utility does not seem be able to browse the network ;)

    HELLO!

  14. Pingback: Mac OSX : Time capcel for FreeBSD | ぼちぼちとやろう!!

  15. And for those who use an external NIC (e.g. b/c the built-in is broken and it’d take Apple way too long to fix it), still use the MAC of the built-in wired NIC.

    Not only for this problem, if TM cannot back up on the volume, check /var/log/messages and it tells you what it exactly tries to do.

    Otherwise everything worked like a charm – Thanks!
    JAN

Comments are closed.