PogoPlug, ArchLinux and Time Machine backup, Pt. 1
One of the great features of Mac OS X is having Time Machine backups of your data. Time Machine can work with an external hard drive plugged in to a USB port, or it can operate over the local network. I have a laptop that spends most of its time on my lap. An external hard drive is just inconvenient. I also don’t want my backups to happen only when I remember to plug the drive in.
Using an plugged-in external hard drive has another downside. It must be formatted to the Mac HFS+ file system. This makes it unreadable on a Windows computer. There are utilities that solve this problem but they may not always be available. Suppose you only have the external hard drive and no other computer. This could happen in a natural disaster1 when you grab the disk and run. Having the disk Windows-formatted will make a big difference. It can be plugged into any computer and be readable.
That same disk, mounted over the network, can stay formatted for Windows and also be used for Time Machine backups. Normally for this to work you’d need to buy an AirPort Extreme or AirPort Time Capsule for $200-400. In this post I’ll walk through how to set up Time Machine on a PogoPlug V4 running ArchLinux for much less.
We won’t be using an external drive just yet. The steps below show how to get the Time Machine server up and running. Part 2 will be about getting the Windows-formatted drive mounted and doing the first backup.2
If the Pogo is configured with a basic ArchLinux install as described in this post, you’re all set. The basic steps are:
- Install Netatalk.
- Add a user.
- Add a mount point and set its permissions.
- Create a configuration file.
- Launch the server and connect to it.
Let’s get started.
$ sudo pacman -S netatalk
Create a user for the Time Machine service.
$ sudo useradd timemachine
By default, this will also create the
timemachine group. Also set a password. Make a note of this, we’ll need it later.
$ sudo passwd timemachine
Create a location for the Time Machine backups. I’m using
/srv3 because it’s a convenient location to keep all the things that are served out onto the network or internet.
$ sudo mkdir /srv/timemachine
Change the owner and group settings to allow the
timemachine user write privileges.
$ sudo chown timemachine:timemachine /srv/timemachine/
Allow any members of the
timemachine group to be able to write to the mount point.
$ sudo chmod g+w /srv/timemachine/
Add yourself to the
timemachine group. It’s important to use the
-aG switch. This means append the group to the list of groups the user is a member of. Using the
-G switch by itself will remove all groups from the user, except for the one specified. That could cause you to be locked out of your home directory and possibly the system. Always use
$ sudo usermod -aG timemachine <username>
<username> means the name of your user account on the Pogo.)
Netatalk is an open-source implementation of the AppleShare file server protocol. It’s the easiest way for a Linux server to speak Apple.
Start by creating the
$ sudo nano /etc/afp.conf
The following will create the Time Machine server. Replace
<username> with the name of your personal account on the Pogo.
; ; Netatalk 3.x configuration file ; [Global] mimic model = AirPort log level = default:warn log file = /var/log/afpd.log hosts allow = 18.104.22.168/24 [Homes] basedir regex = /home [Pogo TimeMachine] path = /srv/timemachine valid users = timemachine <username> vol size limit = 350000 time machine = yes
[Homes] section will allow home folders on the Pogo to be shared over the network. When logging in, the home folder for that user will show up as a shared drive in the Finder.
Also notice that the configuration limits the size of the Time Machine volume to 350GB. This way it won’t take over the whole disk. With a 1TB hard drive, this will leave 650GB free for photos and other files. These files can be read by Windows, and the drive can be still used as normal portable drive.
Adding your user name to the
valid users line will help out with testing. Once things are working, it can be removed.
Start the service with
$ sudo systemctl start netatalk
If there are no errors, you should have a Netatalk server running on the local network.
Now, set it to start at boot.
$ sudo systemctl enable netatalk
On the Mac
First check the Finder, there should be a
PogoArch4 server in the sidebar.
This server should show up without any prompting. Clicking on it will show the server details and a button displaying “Connect As…” Click that button and enter the username and password for your pogo user account. If you save your credentials to the system keychain, it will be connected anytime the server is available.
Once mounted you’ll have access to your home folder and
/srv/timemachine. Both of these folders use the Pogo’s flash drive storage. With an 8GB flash drive, about 5-6GB of space will be available. You can use this as a mini-cloud to store files.
The Pogo TimeMachine folder is where the backups will be stored once an external drive is set up.
In System Preferences, open the Time Machine settings, and click the “Choose disk” button.
If everything is working, you should be able to choose the Pogo TimeMachine disk. When asked for a password, be sure the use the
timemachine user name and password. Also save this to the system keychain. This will let Time Machine log into the server automatically to do the backups.
Once Time Machine has connected it will show the disk details. The free space shown will be the free space on the flash drive as the amount available for the back up. Since it’s so small, any backup attempt will fail for lack of space. The important part is knowing that everything works.
In part two, I’ll show how to add a disk for doing the real backups.
- Or you just want to take it to work, and can’t install the drivers on a company computer. ↩
- While it won’t be part 3, expect a post about installing SAMBA so that the Windows-formatted portion can be used as a network share. ↩
/srv: Abbreviation for “service.” ↩
- This name may be different if you have changed the Pogo’s hostname. Mine is
PogoArch. The default is
alarm. Server naming is its own artform. Greek gods and famous cats are always popular choices. ↩