Use rPi as a Time Capsule - another method

43 posts   Page 2 of 2   1, 2
by lanwarrior » Mon Sep 08, 2014 1:46 am
FM81 wrote:To point one: I assume you have an entry in '/etc/fstab' for the harddisk, and if it is missing you'll get the behaviour you've described ...
It's easy to fix, add the option 'nofail' to the line in '/etc/fstab'; for example before:
Code: Select all
/dev/sda1 /mnt/TimeMachine ext4 defaults 0 2
and after changing:
Code: Select all
/dev/sda1 /mnt/TimeMachine ext4 nofail,defaults 0 2

MfG, FM_81

Thanks for the tip on "nofail" in fstab. Works OK! But now I have a really unique problem: my Mac found the drive on the network and backup started. About 1 hour later, the Time Machine app stopped. I login to the Pi and did a "df- h" and the drive is gone (!?). I ran gparted and it won't even see the disk anymore. I tried to access the folder (/mnt/usbdrive/timemachine) and got:
Code: Select all
ls: reading directory .: Input/output error

Here's the step I did:
1). Format the drive with gparted and ext4 format
2). adduser tmuser with its own password
3). mkdir /mnt/usbdrive/timemachine
4). mount /dev/sda1 /mnt/usbdrive/timemachine
5). add to /etc/fstab --> /dev/sda1 /mnt/usbdrive/timemachine ext4 nofail noexec,defaults 0 0
6). update-rc.d netatalk defaults
7). touch /etc/afp.conf and add the following:

Code: Select all
 mimic model = TimeCapsule6,106
 log level = default:warn
 log file = /var/log/afpd.log
 hosts allow =

 basedir regex = /home

 path = /mnt/usbdrive/timemachine/
 valid users = tmuser
 time machine = yes

8). usermod -aG users tmusers
9). chown tmuser:users /mnt/usbdrive/timemachine
10). chmod 775 /mnt/usbdrive/timecapsule

Is there anything I did wrong?
Posts: 41
Joined: Fri Aug 22, 2014 6:05 am
Location: Somewhere in the you-es-a
by lanwarrior » Tue Sep 09, 2014 3:00 pm
I think I figured out the problem: the initial TimeMachine backup takes a lot of data (33 Gb in my case) because TM essentially is backing up the whole hard drive. So that's a lot of network transfer between the Pi and my MacBook.

The failure ONLY happened if the Pi is connected to the network via Wifi. As soon as I connect it to Ethernet...WHAM... the backup is working great.

I use Edimax wifi and it is properly configured for network access. It's either something with the Wifi or the Pi B+ itself, but transferring 30Gb of data over wireless just corrupted the hard drive.
Posts: 41
Joined: Fri Aug 22, 2014 6:05 am
Location: Somewhere in the you-es-a
by synchrotron » Wed Oct 22, 2014 4:13 pm

I've followed these and other instructions on getting TM working using my rPi, which is great. However many users seem to be using version 3 of Netatalk (using the /etc/afp.conf is one indicator) but when I use;

Code: Select all
sudo apt-get install netatalk

version 2.2.2 is installed and seemingly nothing I do can change this. I've tried compiling from source with no luck.

Does anyone have any pointers how I can update Netatalk to v3 on my rPi?

Many thanks in advance.
Posts: 1
Joined: Wed Oct 22, 2014 4:03 pm
by kwsutter » Tue Nov 25, 2014 2:28 am
These instructions worked great. I was able to get the TimeMachine to recognize the drive connected to the pi, and the backups were working flawlessly. But, when I went to upgrade the HDD on my macbook, I couldn't get the macbook to recognize the external drive for restoring my HDD. I was attempting to direct connect the external drive to the macbook. It didn't recognize the ext4 file system. And, I couldn't get the limited boot drive to recognize the pi on the network to try to restore the HDD via the network.

Luckily, my old HDD was still working just fine, so I swapped the HDD drives. Backed up directly to the external usb drive via direct connect. And, then swapped the HDD drives again and restored from this backup. But, if my original HDD had failed, I wouldn't have had a backup.

Any ideas on how to get this TimeMachine backup to be recognized if it's direct connected to the macbook?

Thanks, Kevin
Posts: 1
Joined: Tue Nov 25, 2014 2:18 am
by strawberrytau » Thu Mar 05, 2015 5:30 pm
I plan to set this up on my rPi, but I worry about kwsutter's point. As a backup, it is essential that this is restorable. Using HFS+ format makes the backup pluggable into the Mac if all else fails. With ext4 it is more tricky.

How poor is the performance on rPi with HSF+? And has anyone successfully restored from an ext4 drive over the network?
Posts: 67
Joined: Wed May 30, 2012 7:56 am
by chefshoes » Mon Apr 06, 2015 11:06 am

got mine up and running and backing up 3 macs (they're on wifi, the pi is not), and as all three have a combined total of about 600gb it will take a day or so ;)

anyway a couple of questions.

1. i turned on my mac this morning to see if i can restore from a backup, but the pi does not appear as a backup option, if it doesnt work how do you guys get a restore up and running?

2. i can only "see" the time machine disk if i use afp://ipaddress first, is there a way for the mac to see it automatically first?

Posts: 2
Joined: Mon Apr 06, 2015 10:52 am
by chefshoes » Mon Apr 06, 2015 12:59 pm
i found this if you are restoring from a shared drive (be it on linux or otherwise)

bit more fettling and handson moreso than the automatic easiness of a real capsule but it looks like you can restore from a backup ... work-drive
Posts: 2
Joined: Mon Apr 06, 2015 10:52 am
by Julain » Sun Jun 21, 2015 11:12 pm
Somehow the Mac doesn't recognize the full size of my backup drive...

Did anyone else have the same problem? Thanks!
Posts: 1
Joined: Sun Jun 21, 2015 11:07 pm
by flex29er » Thu Aug 20, 2015 10:27 am
Will this work with encryption turned on in Time Machine on the Mac?
Posts: 1
Joined: Thu Aug 20, 2015 9:21 am
by buckythepirate » Thu Dec 17, 2015 9:04 pm
Thanks for the very readable tutorial! I'm having trouble with the section where you write over your hard drive with a single ext4 partition... my output from GParted is on imgur:

Any ideas on why this isn't working?

EDIT: I came back the next day and tried the exact same things again... I can't say anything except keep trying ^_^
Posts: 3
Joined: Tue Dec 08, 2015 2:33 pm
by diesel79 » Tue Mar 08, 2016 12:31 pm
I´ve spent a lot of time with this, never got it working satisfactory for me. The only way that worked (for a period of time, until it didn´t) was making a sparse bundle while disk was attached to mac. Then connect to pi, and have a script on my mac auto mount that sparse bundle.

My question is, is it at all possible to use a HFS+ disk, and have it not make a sparse bundle? In other works, just connect a already working TimeMachine disk to a Pi and pick it up from there. It just seems like a whole lot of trouble to still end up with a sparse bundle (which after awhile stopped working for me, but that´s a different story)

Thanks for any help,
Posts: 2
Joined: Tue Mar 08, 2016 12:26 pm
by lufbrarunner » Tue Mar 08, 2016 7:43 pm
Worked like a dream. The first backup took a while but the incremental ones are fine. Thanks for the tutorial.
Posts: 1
Joined: Wed Apr 09, 2014 2:48 pm
by raztafari » Mon Mar 28, 2016 5:39 pm
Can't see the disk on my mac.
I followed all the steps and i can connect to the disk using afp://mylocalip

The disk still never shows up in Time Machine, anybody know why?

I have added:
1. In /etc/fstab.
"/dev/sda1 /mnt/TimeMachine ext4 nofail,defaults 0 2"

2. In /etc/netatalk/AppleVolumes.default
"/mnt/TimeMachine \"Time Machine\" options:tm"

Tried restarting the server and also checked so that Netatalk service is running and broadcasting the disk with "sudo service netatalk status -l".

Thanks in advance!
Posts: 3
Joined: Wed Mar 23, 2016 8:31 pm
by Rlyacht » Thu Mar 31, 2016 4:45 pm
I'm also having trouble with this. I can select the drive in time machine and start a backup. I can see on the pi that the sparsebundle directory gets created, and then it creates the bands subdirectory and others. It writes out around 4M of stuff to it, but then deletes them, and I get a "backup failed" message on my mac.

I turned on defaults:debug in logging and I noticed two things that make it look like there was an error (AFPERR_NOOBJ) and then it was terminated.
Code: Select all
Mar 31 02:05:45.382575 afpd[12244] {afp_dsi.c:633} (debug:AFPDaemon): ==> Finished AFP command: AFP_GETFLDRPARAM -> AFPERR_NOOBJ
Mar 31 02:08:08.901671 netatalk[12213] {netatalk.c:158} (info:AFPDaemon): Exiting on SIGTERM
Mar 31 02:08:08.902241 afpd[12218] {main.c:105} (note:AFPDaemon): AFP Server shutting down
Mar 31 02:08:08.911601 afpd[12244] {directory.c:566} (debug:AFPDaemon): dirlookup(did: 80): START
Mar 31 02:08:08.912926 cnid_metad[12219] {cnid_metad.c:138} (note:AFPDaemon): shutting down on SIGTERM

Here's my setup
  • model B
  • drive is a 1T external USB , formatted as ext4
  • netatalk 3, from debs I downloaded
  • raspbian 4.1.19+ #858

p.s. Strangely, this seems to be a problem on my network. I can use it as a time machine from a different machine on my network with no problem. The mac i was using to test is connected via a powerline adaptor, and I see the base is sending some weird responses that avahi-daemon is logging. At this point, it seems to be my problem, so no need to reply unless you have any suggestions , which would of course still be great :-)
Posts: 3
Joined: Wed Mar 30, 2016 2:37 pm
by silverbirch » Fri Apr 01, 2016 6:13 pm
Thank you for this guide - it worked straight away!
Posts: 1
Joined: Fri Apr 01, 2016 6:11 pm
by honickchar » Sun Apr 17, 2016 4:08 pm
This didn't work the first time, but after following the hints in the comments it worked great.

After mounting the drive
Code: Select all
 sudo chmod 777 /dev/sd* /mnt/TimeMachine*

and then remounting the drive.

After I got it working, I wanted to try it with hfs+ formatted drives:
I had to install the file type packages to use the filesystem.
Code: Select all
sudo apt-get install hfsplus hfsprogs

You can format the drives in Gparted, but it's probably best to do the formatting with the Mac since you have to turn off journaling and I didn't see a way to do that through Linux.

To turn off journaling,
On the Mac:
    open disk utility
    select the partition you want
    hold the option key and then open the file menu
    select 'disable journaling'

once journaling is turned off, you should be able to plug the drive back in to the pi and it's good to go
Posts: 1
Joined: Sun Apr 17, 2016 3:54 pm
by csnite » Thu Sep 15, 2016 3:49 am
I have a question now: Say you actually needed to use your backup drive to restore your Mac. Is the process the same as before (boot to recovery mode, select drive?) Is it possible to recover from a network drive? and my 2nd question, is it possible to unplug the network drive from the rPi and plug it directly into the Mac and recover that way?

Posts: 1
Joined: Thu Sep 15, 2016 3:47 am
by Sanjiboy » Thu Dec 22, 2016 11:21 pm
I know this thread is ancient, but I have a question about it. Everything seems to be working, but when I select my Time Machine drive in the Time machine app, it says "The server may not exist or it is unavaiable at this time. Check the server name or IP address, check your network connection, and then try again." im definitely connected, as I can see the drive, so im not sure whats going on. Any ideas?

Posts: 1
Joined: Thu Dec 22, 2016 11:15 pm