Om gebruik te blijven maken van Time Machine op mijn Mac moet er op de Pi netatalk geinstalleerd worden.
Hiermee doet de Pi zich voor als externe disk, waar een Time Machine backup op gemaakt kan worden.
Backing up several Macs using a Linux based Time Machine server
Backups were one of my first concerns when we started Musikki. As soon as we got more than a few machines and a local all-purpose server, I started looking for a way of easily backing up everyone’s Macs.
The solution turned out to be quite simple, despite the initial setbacks caused by bad configuration.
So, if you want to do Time Machine based remote backups and have all of the following: a local network; one or more macs; a box running ubuntu - you are half way through. You just need to install and properly configure Netatalk.
On their own words, Netatalk is
“[...] a freely-available Open Source AFP fileserver. A UNIX, Linux or BSD system running Netatalk is capable of serving many Macintosh clients simultaneously as an AppleShare file server (AFP)”
After doing sudo apt-get install netatalk, make sure you follow this checklist:
- Create a user on the linux box to deal with the backups. Let’s say you name it tmbackup.
- Create a folder to store the backups and make sure your previously created user has +rwx permissions. Let’s say you name it /timemachine.
- Append (or edit) /etc/netatalk/adpf.conf to look like this:
At this point, you should be able to see the Time Machine volume on your Macs and be able to set the backups using the tmbackup user. There are other configurations available but these should be enough to get you going.
El Capitan Time Machine Backups to Ubuntu 14.04 LTS
Had some problems with Time Machine suddenly on Ubuntu 14.04 after a recent software update. I found there are a lot of posts about afpd mounts not showing up properly in Finder on El Capitan, but that isn’t my big concern.
The TL;DR of this is I found a PPA to install netatalk 3 on Ubuntu. This dramatically simplifies the afp setup to something like this:
you can list accessible modules under /usr/lib64/netatalk/In my case for openSUSE 13.2 it is:`uams_clrtxt.so uams_dhx2_passwd.so uams_dhx_pam.so uams_dhx.so uams_guest.so uams_passwd.so uams_randnum.souams_dhx2_pam.so uams_dhx2.so uams_dhx_passwd.so uams_gss.so uams_pam.so uams_pgp.so`
I acquired an old Drobo Gen2, but it's a pretty slow device so I'd like to try using it as a networked Time Machine drive. Attaching a disk array to my home server seemed redundant, I'd rather that thing focus on streaming, and I want my macs to be able to sleep, so I figured I'd try out my ASUS RT-N16 router as a Time Capsule. It runs/can run linux-based firmware and most of the necessary tools are available through entware.
It turned out to not be the best idea in the world, but guides I could find on doing this were thin and full of holes, so I decided to write my own for anyone who doesn't mind that it's really slow and could shorten the life of your router.
Only the Step 4 is specific to using a Drobo, so technically this is just a guide to turning your router into a Time Capsule.
Software installed in this guide:
busybox
Provides various linix system tools
drobo-utils
Drobo management for linux
dbus
Allows applications to talk to eachother in a standard way
avahi
Enables zeroconf, allowing your router to advertise services to your macs in a way they can understand (Bonjour). The file server we create on the router will automatically show up in your finder with a neat little icon and everything.
netatalk
Enables the router to serve files over the standard Apple File Protocol
Step 1: Install Merlin's ASUS Firmware
I generally choose Merlin's firmware for ASUS routers. It's close to stock, but frequently updated, a lot more secure, and opens up a lot more capability. Much of this guide may get you where you need to be with other linux-based firmware such as Tomato, but I'm focusing solely on the tools available in Merlin's.
After install, enable JFFS. This creates a partition on the router's flash memory which will survive reboots, letting us create scripts and configuration files that hook into and extend the base system which gets reflashed at every boot.
Enable SSH in Administration, System tab. Your username and password to connect via SSH will be the same as that for the router's web interface.
Step 2: Install entware
Note: ASUS's DownloadMaster is incompatible with entware, and the installer will remove it. That's fine for me, I don't use DownloadMaster. While DownloadMaster IS compatible with optware, optware is seemingly no longer maintained and no one should be using it.
I want the entware install to be portable, so I'm going to install it on a USB thumb drive. The drive must be formatted ext2 or ext3. Once you've got your drive plugged into one of your router's USB ports, simply install entware.
Step 3: Install busybox
BusyBox is a prebuilt library of unix tools that aren't generally available on embedded linux systems, such as something as simple as adduser. Installation is easy with entware:
opkg install busybox
Step 4: Setting Up the Drobo
Drobo doesn't provide first-party tools for linux, so I'll be using drobo-utils. You may want to read the portions on LUN sizes, but I generally skip all of that by formatting the drive with a real, first-party Drobo Dashbash installed on another machine. When formatting, drobo-utils will use whatever LUN size is already set on the device. It doesn't matter what filesystem it's formatted at that point, just that we're setting the LUN size to the maximum your particular Drobo will support (16TB for the consumer-level Drobos).
Note: I really recommend formatting the Drobo on a more powerful linux machine. Ubuntu has drobo-utils in apt, spin up a virtual machine and do it there. The router is just too slow to do this in a reasonable amount of time, and even on a more powerful machine a 16TB LUN can take hours to format. That said, if you insist on doing it on the router, here are instructions specific to doing that.
On the router, you'll need to install drobo-utils' dependencies before it'll work:
opkg install git parted python
Once that's done, we'll fetch the latest from drobo-utils' git repo and put it on our thumb drive (assuming it's at /mnt/sda1):
cd /mnt/sda1 git clone git://drobo-utils.git.sourceforge.net/gitroot/drobo-utils/drobo-utils
It's not designed to run on entware, and assumes python is in the standard *nix sbin path, so we have to change that by editing the drobom file in drobo-utils. Change the first line to read:
#!/opt/bin/python
Now just connect the drobo to the other USB port on the router, give it a few minutes to spin up, and drobo-utils should be able to find it when you run drobom status:
/dev/sdb - Drobo disk pack 00% full - ([], 0)
Now we can use drobom to format the array.
./drobom format ext3
It's going to take a while. Seriously, a really long while. You really might want to do this on a more powerful linux machine.
Once it's formatted, you can mount it to /mnt/Drobo01 (or whatever your Drobo is named), or reboot the router and it'll be mounted to the same place automatically.
Create a directory on the Drobo named TimeMachine
mkdir /mnt/Drobo01/TimeMachine
Step 5: Dealing With Reboots
As mentioned before, the router's embedded linux does not survive reboots. We're going to be adding some users and groups here which are added to the regular old /etc/passwd and /etc/group files. They will not survive a reboot, so we need to make creating them something that happens at every boot. To do this, we'll create a startup script that will contain each command we need to run at boot. Create /opt/etc/init.d/S00setup and add the following as the first line:
#!/bin/sh
Now make it executable
chmod +x /opt/etc/init.d/S00setup
Keep in mind, will need to add every adduser and addgroup command we use in this guide to this file so it can be run on every boot.
Step 5: Install dbus
dbus would normally be installed as a dependency of the other packages we'll be installing, but since it requires some additional configuration, I install it separately and make sure it's working before moving on.
opkg install dbus
If you were to try and run dbus now, it would throw errors like this:
Failed to start message bus: Could not get UID and GID for username "root"
entware's dbus package does not come properly configured for the Merlin environment out-of-the-box and expects to run as user root which does not exist. To solve this, open /opt/etc/dbus-1/system.conf and change the user option to nobody:
<!-- Run as special user --> <user>nobody</user>
Once this is done, dbus will start as normal.
/opt/etc/init.d/S20dbus restart
dbus also has a habit of leaving its PID file behind. Edit /opt/etc/init.d/S20dbus and add the following after #!/bin/sh
rm /opt/var/run/dbus.pid > /dev/null 2>&1
Step 6: Install avahi
avahi broadcasts services to the network using a system called zeroconf, known in the Apple world as Bonjour. It's going to let our Drobo show up nice and pretty in Finder with a Time Capsule icon and everything.
opkg install avahi-daemon avahi-utils
avahi needs to start with an unprivileged user and group, and though entware's package for it uses the nobody user, it expects a group named nogroup — No such group exists in Merlin's firmware. Create the group:
Edit /opt/etc/avahi/avahi-daemon.conf, uncomment the host-name line and give it a name:
host-name=TimeCapsule
avahi uses XML files to describe services, so we're going to create one to tell it about the AFP (Apple File Protocol) service we're going to create with netatalk in a minute. Edit or create /opt/etc/avahi/services/afpd.service with the following content:
Make /mnt/Drobo01/TimeMachine available as a shared drive named "TimeMachine"
Hide unnecessary system volumes
Make it accessible only to users in the timemachine group (which we will create in a second)
With options to make dotfiles visible, use OS X AFP3 user privileges, and enable Time Machine for the volume.
Note: netatalk is going to report the maximum LUN size of the Drobo as its actual capacity, which can cause problems. You may want to set volsizelimit on the share.
This will allow us to have multiple users if we need them, each with their own login. Keep in mind if you create users for this, you will have to do the user creation AND password setting in the S00setup script:
Note you'll want to keep track of the UIDs for those users, since the drive may be mounted before the setup script runs and you'll want the UIDs on the drive data to match the users that create the backup files.
I will just be using the same username and password as the web interface, so I will simply add user /admin/ to the /timemachine/ group:
adduser -G timemachine admin
Restart netatalk...
/opt/etc/init.d/S27afpd restart
Or just reboot the router entirely. You should now be able to connect to the TimeCapsule and TimeMachine share, and set up Time Machine on your mac.
Epilogue
This is EXTREMELY slow on the RT-N16. I let an encrypted backup run overnight and I only saw 80GB moved, the whole time running the router red hot. It's obvious the router is really not powerful enough to do this efficiently, and it doesn't exactly help that netatalk is severely outdated in entware. Pogoplugs are cheap and can run ArchLinux, so I may try that next.
Jordan Hubbard has been in the dugout at ixSystems for less than a year now and already we’ve seen some miraculously fast releases for FreeNAS that include a jump to FreeBSD 9.1 and now 9.2 is a release candidate which fixes some really vexing AFP…