Time Machine is the built-in backup feature of OS X. It keeps a copy of all your files, and remembers how your system looked on any given day so you can revisit your Mac as it appeared in the past. Apple sells a device called a Time Capsule, but rather than buy one of these I opted for a diy approach using my Raspberry Pi and so far it seems to be working well.
My setup consists of:
- Raspberry Pi Model B running Raspbian connected via network cable to a router
- MacBook Pro running OS X Yosemite v10.10.1 connected via Wifi to a router
- External 2TB drive (with separate power) attached via USB to the Raspberry Pi
1. Start with a clean installation of Raspbian, configured for your network
2. Power down your Pi, connect your storage drive, and boot your Pi back up.
3. Since my Pi only has 2 USB ports, I wasn't able to have a Keyboard, Mouse and USB drive connected without using a USB hub. Since I didn't want to use a USB hub I installed a VNC server on the Pi and a VNC client application on the Mac using instructions from http://www.raspberrypi.org/documentation/remote-access/vnc/ which can be summarised as follows.
$ sudo apt-get install tightvncserver
$ vncserver :0 -geometry 1920x1080 -depth 24
$ sudo apt-get upgrade
$ sudo apt-get install netatalk gparted
5. Start up the graphical desktop on your Pi using startx, and run gparted (it's under "preferences" in your start menu). Select your storage drive (not your SD card), delete any existing partitions, and create a new single partition of type ext4. Then exit gparted.
6. Set your Pi to connect to your storage drive when you boot, and create a place in your Pi's filesystem for it to go
a) create the directory with appropriate permissions
$ sudo mkdir /mnt/TimeMachine
$ sudo chmod 777 /mnt/TimeMachine
b) setup auto boot
$ sudo echo "/dev/sda1 /mnt/TimeMachine ext4 defaults 0 2" >> /etc/fstab
This command came up with a Permission denied error so I instead manually updated the /etc/fstab file using nano with the entry in quotes (/dev/sda1 /mnt/TimeMachine ext4 defaults 0 2) added at the end.
$ sudo nano /etc/fstab
c) mount the drive
$ sudo mount /dev/sda1
7. Configure netatalk to share the directory
a) setup netatalk
$ sudo echo "/mnt/TimeMachine \"Time Machine\" options:tm" >> /etc/netatalk/AppleVolumes.default
This command came up with a Permission denied error so I instead manually updated the /etc/netatalk/AppleVolumes.default file using nano with /mnt/TimeMachine "Time Machine" options:tm added at the end (Note: the \'s have been removed from the echo command).
$ sudo nano /etc/netatalk/AppleVolumes.default
b) restart netatalk
$ sudo service netatalk restart
8. On your Mac open your Time Machine preferences, click Select Disk, and choose Time Machine on raspberrypi. I found initially that I couldn't find the Time Machine share so I went to Finder and connected to the Raspberry Pi at afp://pi_ip_address
9. The backup should commence after a couple of minutes.
Raspberry Pi is a trademark of the Raspberry Pi Foundation
Apple, Mac, MacBook, MacBook Pro, OS X, Time Capsule and Time Machine are trademarks of Apple Inc.