APC Australia

Make a Mac Time Capsule with a Raspberry Pi

Learn how to build an inexpensiv­e, Raspberry Pi-based networked backup drive. Lucy Hattersley

-

We’re big fans of the Raspberry Pi. This tiny and inexpensiv­e computer packs enough power to run Linux and can be used for many fun projects. We’re going to make a Time Capsule using a Raspberry Pi 2 and an external hard drive. You’ll need to download and install some extra software so the Pi can use a Mac-formatted drive and talk to Time Machine on your Mac. (Note, because this is an unofficial method, you shouldn’t rely on it as your only backup.) This guide assumes that you’ve already got your Raspberry Pi up and running, with OS already installed.

With your hardware ready to go and Raspbian’s desktop in front of you, choose Menu > Accessorie­s > Terminal, which is similar to the Mac app of the same name. At its command line, enter sudo apt-get update && sudo apt-get upgrade to make sure your installati­on is up to date. You’ll see lines of text filling Terminal’s window. This process will be finished when the scrolling stops and you see another coloured line of text that ends with a $. Now we can get down to business with the various bits of required software. Portions of what follows are based on Caleb Woods’ tutorial at http://bit.ly/mfcwtc.

GET THE PI TO READ A MAC DISK

First, download the tools Raspbian needs to work with Apple-formatted drives. In Terminal on the Pi, enter sudo apt-get --assume-yes install hfsprogs hfsutils hfsplus to download them.

To check where the drive is connected in the system, enter sudo /sbin/parted then, at this tool’s own command line, enter print to get info about your external drive. The command’s output will include a line that starts with ‘Disk / dev/sda’ followed by the drive’s capacity. Below that, a table should have two rows: find the one that refers to the partition named ‘ Time Machine’ on the external drive – all being well it should be 2. This tells us /dev/sda2 is the location of the Time Machine partition. Enter quit.

We need Raspbian to mount the drive so we can use it. First, create a folder by entering sudo mkdir -p / media/time_ machine. The last

parameter there represents where the partition’s fi le system will be mounted, much like the / Volumes folder in OS X.

Next you’ll use a text editor, Nano, to edit a fi le that contains a list of all file systems we want the system to mount at startup. Enter sudo nano / etc/fstab. This fi le will contains several entries already. Below them (but above the lines starting with a # symbol), add the following text as a single line. (Where you see a gap in the text below, press the Tab key once, rather than the Spacebar.) /dev/sda2 /media/time_ machine hfsplus force,rw,user,auto 0 0 Press Ctrl-O and then Enter to save your changes to the fi le, then press Ctrl-X to quit Nano. Now you’re back at the command line, enter sudo mount -a to ensure the partition is mounted.

GET THE MAC AND THE PI TALKING

Next we’ll install Netatalk. We need version 3.0 or higher, which we’ll build from source code. Open the Epiphany web browser from the left end of Raspbian’s Task Bar and go to netatalk.sourceforg­e. net. Under ‘current releases’ on the left, click the link to download the latest stable version (3.1.8 at the time of writing) in gzip format. It will be saved to your Downloads folder, and the Xarchiver app will open to show you its contents. Right-click the fi le within and choose Extract (if right-clicking doesn’t work with your mouse, select the fi le, then choose Action > Extract). Put it in your Downloads folder (it should already be chosen for you).

We need to install the packages listed at bit. ly/mfntpackag­es. If you’re new to this, it’s safest to install one at a time. For each of the required packages, type sudo apt-get --assume-yes install followed by a space, type the name of a package, then press Enter.

Enter cd ~/Downloads/ netatalk-3.1.8. To configure Netatalk’s installer, enter the following text – every double hyphen should be preceded by a space, and every line below that ends with a hyphen has no space after it.

./configure --with-initstyle=debian-systemd --without-libevent --withouttdb --with-cracklib --enablekrbV-uam --with-pam-confdir=/ etc/pam.d --with-dbussyscon­f-dir=/etc/dbus-1/ system.d --with-trackerpkg­config-version=1.0

You’ll see a summary when this process completes. The next few commands each take a while to complete. Enter sudo make. When it’s done, enter sudo make install to run the installer. When this fi nishes, verify Netatalk installed correctly by entering afpd -V. The fi rst line of the response will be ‘afpd 3.1.8 - Apple Filing Protocol (AFP) daemon of Netatalk’.

To start the software, enter sudo service avahi-daemon start, followed by sudo service netatalk start. These shouldn’t return any output, but you should see ‘raspberryp­i’ appear under Shared in Finder’s sidebar on your Mac.

“We’re going to make a Time Capsule using a Raspberry Pi 2 and an external hard drive. You’ll need to download and install some extra software so the Pi can use a Mac-formatted drive and talk to Time Machine on your Mac”

 ??  ??
 ??  ?? There are a few Raspberry Pi models. We’ll use the Pi 2 Model B; an old 5W iPhone USB mains adaptor will power it.
There are a few Raspberry Pi models. We’ll use the Pi 2 Model B; an old 5W iPhone USB mains adaptor will power it.

Newspapers in English

Newspapers from Australia