Setting up Time Machine on Ubuntu 10.04

Backups and redundancy are always important when dealing with data you’re not willing to loose overnight when your hard drives decide it’s time to meet their maker. Usually Seagate or Western Digital in my case, not that I’m complaining *knocks on wood*. Mistakes also happen and you’re bound to eventually delete or somehow damage important data on your hard drive.

Time Machine is a piece of software introduced by Apple when Leopard was launched, it allows us to set up an external or network drive as a backup drive and it backs up data from any given point in time onwards allowing us as well to go “back in time” to any given point in the backups.

Recently I’ve been dabbling a lot with Ubuntu and those of you who know my nerd side know already I’ve googled the hell out of it trying to maximize and/or improve stuff and I’ve come across several interesting articles I’d like to share with whoever reads this. I could just post some links, but that wouldn’t be fun and some of the links might be taken down leaving me without any source of information in case I want to repeat the process.

On with the interesting part, setting up Ubuntu 10.04 as a Time Machine network drive.

Ubuntu is able to speak the Apple language when it comes to networking, all we have to do is install the netatalk package and in case we want to be able to dinamically find the server in our finder window for example, the avahi-daemon package.

$ sudo apt-get install netatalk avahi-daemon

Everything pretty much works right out of the box, we just have to edit a text file describing what directory to use for Time Machine and restart the services.

For this, we will edit /etc/netatak/AppleVolumes.default and add the following:

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

This will point netatalk to a directory called TimeMachine in our root filesystem and share it. It can be a directory inside your home dir. Now we have to actually create the directory and give it the correct permissions.

$ sudo mkdir /TimeMachine

$ sudo chmod a+rw /TimeMachine

Next up, in case we want it showing up on our finder instead of having to connect to it through the “Connect to Server” dialog (afp://192.168.ip.ip), we’ll create a file named /etc/avahi/services/afpd.service and add the following content into it:

<service-group>
<name replace-wildcards=”yes”>%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>
Next, we’ll restart the services. I’m not sure you actually have to restart the avahi-daemon but we’ll do it anyway.
$ sudo service avahi-daemon restart
$ sudo service netatalk restart
Alternatively, you can:
$ sudo /etc/init.d/avahi-daemon restart
$ sudo /etc/init.d/netatalk restart
Either way works fine.
And that’s it! That folder is ready to act as a Time Machine network drive for your macs :)
It is advisable to keep the folder with enough space  for your backups, usually something with twice the space of your used space in disk works but the bigger the better since it allows you to go further back in time. Folders used in these screenshots were made for example/test purposes and have nowhere near the required size to effectively act as a Time Machine server.
The server is visible in your finder window
The folder is visible in your Time Machine window.
Full credit for this info goes to: