Making Time Machine Works With Ubuntu 10.10 Using AFP

Mac users are familiar with Time Machine!  In case you got no idea what’s Time Machine, it’s a backup software which is available by default on all Mac systems.  If I’m wrong on that, at least Time Machine has been available on my Mac without any additional installation right off the bat — it was available when I first purchased my Mac.  Time Machine is a very good backup software since it’s remembering the changes within your file system.  For an example, you have 40 GB data worth to be backed up, but halfway through, your Mac got shut down from a power outage; don’t sweat young, brave Jedi, because when you fire up the Time Machine again at anytime after the power outage incident, the Time Machine automatically picks up where it had left — it means instead of backing up the whole 40 GB data worth over again, Time Machine just have to back up whatever files that had never been backed up before (it also works for files that just recently have changed such as new data).

OK, Time Machine is great, but the software itself is useless unless you have a hard drive either external one or the internal one to be made available somewhere on your network or localhost so the files can be copied over from mac for backups.  A major drawback for Time Machine is that if an external hard drive or internal hard drive is not connecting to another Mac system, Time Machine won’t recognize the available backup drive(s).  There is a workaround for this!  Some people have expertly configured Samba on a Linux machine to allow Time Machine to work this way.

Unfortunately, I don’t know how to make Samba works with Time Machine, and so I resort to another method!  This method is just as good which utilizes the AFP system which is also known as AppleTalk Filing Protocol.  To be even more specific, I know how to make AFP works with Time Machine using Ubuntu 10.10!  I don’t think it’s that much of a different if you’re using Ubuntu 10.04 (an earlier version) — it should work for you if you’re using Ubuntu 10.04 instead of Ubuntu 10.10.

Before taking on this adventure, you need to make sure you’re comfortable with pasting command lines into a terminal inside Ubuntu, editing files (that’s, configuration files) of various applications in terminal using vim.tiny or vi or pico or nano, opening new ports inside the firewalls (cannot show you how to do this as it’s beyond the scope of this article, and if you have both firewalls on Mac and Ubuntu — you know the deal), and starting and stopping services on Ubuntu.  Now you have been warned and informed of the important details, let get started!

1)  Either ssh into your Ubuntu 10.10 or log onto Ubuntu PC physically, open up a terminal and type in this command sudo aptitude install netatalk without using the double quotes.  In case you don’t know, Ubuntu 10.10 stops shipping Aptitude by default (as in out of the box), therefore you need to install Aptitude before you can execute the previous command.  To install Aptitude, just type in “sudo apt-get install aptitude” without the double quotes.

2)  Open up /etc/netatalk/AppleVolumes.default with vim.tiny or nano or pico or vi, and then enter /your/path  VolumeName allow:@groupname options:usedots,upriv,tm allowed_hosts:x.x.x.x(x stands for IP address of the Mac machine that need to be backed up) at the end of this file.

3)  Restart the AFP service on Ubuntu by typing in this command “sudo /etc/init.d/netatalk restart” without using the double quotes.

4)  Avahi Daemon  and Libnss-mdns should be installed on Ubuntu 10.10 by default.  But if these packages aren’t yet installed, you need to install these applications using the command line “sudo aptitude install avahi-daemon libnss-mdns” without using the double quotes.

5)  Open up the file /etc/nsswitch.conf and add “mdns” at the end of the line which looks like this (hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 mdns).

6)  Let add a XML configuration file to AFP so Ubuntu will broadcast the AFP service to any Mac that wants to use the service.  By doing this, your Mac will see the available drive(s) for the Time Machine to use.  So, change directory into /etc/avahi/services/ and create a new file with the name of afpd.service.  Use vim.tiny or whichever file editor you like and open up the file /etc/avahi/services/afpd.service and enter the configuration below:

<?xml version=”1.0″ standalone=’no’?><!–*-nxml-*–>
<!DOCTYPE service-group SYSTEM “avahi-service.dtd”>
<name replace-wildcards=”yes”>%h</name>

Just make sure you remember the port number so you can open up the same port number in your firewall — in the case above, the port number is 548.  The part where it says <txt-record>model=MacBookPro</txt-record>, you can modify “model=MacBookPro” into the type of Mac machine that you’re using.  For an example, if you’re using other than MacBookPro, then you should enter one of these:  Macmini, iMac, MacPro, Xserve, MacBook, or MacBookAir.

7)  Lastly, let restart your Avahi Daemon by typing in the command “/etc/init.d/avahi-daemon restart” without using the double quotes.  To be extra careful, you can always restart your Ubuntu and your Mac.  Don’t forget to launch your Time Machine so the backup process can begin!  Time Machine will ask you to select a Volume, but you already know the Volume you want right?  Remember when you have to configure the file /etc/netatalk/AppleVolumes.default?  If you do, then you also remember the command line you entered — the part where it says VolumeName, you can basically make up any name for the VolumeName.  This is where also the part you have to rename the @groupname with the group of the user that owns the directory on Ubuntu where Time Machine will copy the backup files onto it.

Additional tips:  When things are not working out, make sure you check your Firewall settings on both Mac and Ubuntu (that’s, incoming and outgoing ports), the running services such as AFP and Avahi-Daemon, and the mistyping errors that you might have entered into the configuration files that I mentioned above.

Thanks to here that I have learned about how to use AFP inside Ubuntu as a NAS for Time Machine!  Giving credit where it’s due — source.

8 thoughts on “Making Time Machine Works With Ubuntu 10.10 Using AFP

  1. Pingback: [Update] Configurer une sauvegarde réseau Time Machine vers un serveur Linux Ubuntu |

  2. Pingback: Dolly Drive Turns The Cloud Into Time Machine | EssayBoard

  3. Is it possible to use a second drive in the ubuntu machines as a backup drive? I have a 300 GB disk, mounted to /mnt/spare in ubuntu (but it’s not a permanent mount, ie, won’t mount on startup).

    I added this line to AppleVolumes.default:
    /media/spare “Backup Drive” allow:bob options:usdots,upriv,tm,allowed_hosts:10.10.1.

    I can see the ubuntu machine and the “Backup Drive” share in the Mac Finder, but it doesn’t show up in TM.

    When I do the same exact thing, but I use a directory inside my home folder on ubuntu (videos, for example), then TM will recognize the shared folder as a eligible backup disk

    • I’ve found out that TM can only be recognized when a volume is active. Which means you need to start the spare drive on every fresh boot. Why not make that drive permanently mount on Ubuntu? You can do so in /etc/fstab.

  4. Pingback: Ubuntu Server vs. Mac Server « Spencer's Technical Diaries

  5. I’ve been struggling with this for some time.. everything works using an ethernet cable.. over wifi it doesn’t. However, I see my other mac over wireless. 😦

    mounts on IP works though

  6. I’m trying to do this, but having problems.
    I’ve followed the steps but can not log in to the server from my mac. I get wrong pw or user, all the time.

    here is the bottom portion of my appletalk config:

    # The line below sets some DEFAULT, starting with Netatalk 2.1.
    :DEFAULT: options:upriv,usedots

    # By default all users have access to their home directories.
    ~/ “Home Directory”

    /media/Samsung Samsung allow:Oskar,avalon options:usedots,upriv,tm

    # End of File

    my mac user is Oskar and my server user is avalon. Why cant i login?

    • Are you behind a firewall? If you’re, make sure you have the right port open! Googling for the right ports! Also, make sure you know how to open ports for your specific firewall.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.