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:
Let’s get started.
Install the netatalk package.
Create a user for the Time Machine service.
By default, this will also create the timemachine group. Also set a password. Make a note of this, we’ll need it later.
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.
Change the owner and group settings to allow the timemachine user write privileges.
Allow any members of the timemachine group to be able to write to the mount point.
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 -aG.
(<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 netatalkconfiguration file.
The following will create the Time Machine server. Replace <username> with the name of your personal account on the Pogo.
The [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 systemd.
If there are no errors, you should have a Netatalk server running on the local network.
Now, set it to start at boot.
First check the Finder, there should be a PogoArch4 server in the sidebar.
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.
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.