Apple Time Machine and Netatalk 3: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
mNo edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
This is really about setting up Time Machine to do OS/X backups.
Setting up Time Machine to do OS/X backups.
OS/X can't use Samba with Time Machine, so that's not good enough.
You can do backups to a directly connected storage device such as a USB hard drive,
or you can use a Netatalk device. Apple wants you to buy an "Airport" or some such.
OS/X can't use Samba with Time Machine.


== Update 2017, it's Docker time! ==
== Update 2017, it's Docker time! ==


I am now using docker image now that has netatalk and avahi in it. Much simpler once you find the right image on the Docker Hub.
I am now using docker image now that has netatalk in it.  
It's on [[Murre]] now instead of [[Tern]], I did not see a reason right now to run a separate server just to support Timemachine. Murre is a desktop so it is often sleeping at night but then, so are the Macs. Timemachine is resilient. It turns out Murre is powered up now more often than Tern was.
It's on [[Bellman]] now. Eventually I will need to upgrade /green on Bellman to more than 8TB.
 
Get the image,
docker pull mbentley/timemachine


=== Linux ===
=== Linux ===


Do some housekeeping,
Do housekeeping:
  sudo mkdir /var/log/timemachine
  sudo mkdir /green/timemachine
#Set permissions on the volume you will use for timemachine, so that user 1000 can write there. In my case,
  sudo chown docker:docker /green/timemachine
  sudo chown -R 1000.1000 /volumes/timemachine
 
Start the image, Linux version
docker run -d --restart=always \
  --net=host \
  --name timemachine \
  -v /volumes/timemachine:/opt/timemachine \
  -v /var/log/timemachine:/var/log/supervisor \
  -e PASSWORD=''mysecretgoeshere'' \
  mbentley/timemachine:latest
 
=== Windows ===


Do some housekeeping,
Start image
  d:
  docker run -d --dns=192.168.123.2 --net=host --name=timemachine -v /green/timemachine:/timemachine odarriba/timemachine:latest
cd /
mkdir timemachine/data timemachine/log


Start the image, Windows version
As with other dockers on Bellman, I set it to "restart always" to survive reboots.
docker run -d --restart=always --net=host --name timemachine -v d:/timemachine/data:/opt/timemachine -v d:/timemachine/log:/var/log/supervisor -e PASSWORD=''biggerontheinside'' mbentley/timemachine:latest
 
Any moment now, Murre will show up in servers on my Mac... so cool. So much easier than building from sources...


Now you should be able to open TimeMachine settings on your Mac(s), select your Linux server and enter credentials,
Now you should be able to open TimeMachine settings on your Mac(s), select your Linux server and enter credentials,
user "timemachine" and password "mysecretgoeshere" (or whatever you chose above) and you should be able select and start using
user "timemachine" and password "mysecretgoeshere" (or whatever you chose above) and you should be able select and start using
the TimeMachine share.
the TimeMachine share.
To connect do Cmd-K and type in the URI for example afp://bellman/plover where bellman is the host and plover is the volume used
in the add-account command


Explanation:
Explanation:
I mount a pair of 3TB drives formatted with btrfs as a single filesystem at /volumes/timemachine.  
I mount an 8TB drive formatted with btrfs as a single filesystem at /green.  
I put the local log file is in /var/log/timemachine.  
I put the local log file is in /var/log/timemachine.  
You have to use --net=host so that this docker can use avahi discovery; otherwise your Macs will not be able to find it in Timemachine.
You have to use --net=host so that this docker can use avahi discovery; otherwise your Macs will not be able to find it in Timemachine.
I set my own password to override the default "timemachine".
I set my own password to override the default "timemachine".
Once it's running you should be able to see the log files showing it's working, look in /var/log/timemachine.
'''cd /var/log/timemachine'''
'''cat netatalk.log'''
Apr 26 16:43:33.613717 netatalk[11] {afp_avahi.c:80} (info:AFPDaemon): Registering volume 'TimeMachine' with UUID:  '0795EE37-6397-9B09-00DE-5EB14448BE4D' for TimeMachine
Apr 26 16:43:33.613763 netatalk[11] {afp_avahi.c:94} (info:AFPDaemon): hostname: laysan
Apr 26 16:43:33.613786 netatalk[11] {afp_avahi.c:106} (info:AFPDaemon): Registering server 'laysan' with Bonjour


Since this Docker is built on Debian Jessie you can poke around in it by starting a shell if things don't look right,
Since this Docker is built on Debian Jessie you can poke around in it by starting a shell if things don't look right,
Line 136: Line 113:
[[Category: Don't Panic!]]
[[Category: Don't Panic!]]
[[Category: System Administration]]
[[Category: System Administration]]
[[Category: OS/X]]

Latest revision as of 15:37, 27 October 2021

Setting up Time Machine to do OS/X backups. You can do backups to a directly connected storage device such as a USB hard drive, or you can use a Netatalk device. Apple wants you to buy an "Airport" or some such. OS/X can't use Samba with Time Machine.

Update 2017, it's Docker time!

I am now using docker image now that has netatalk in it. It's on Bellman now. Eventually I will need to upgrade /green on Bellman to more than 8TB.

Linux

Do housekeeping:

sudo mkdir /green/timemachine
sudo chown docker:docker /green/timemachine

Start image

docker run -d --dns=192.168.123.2 --net=host --name=timemachine -v /green/timemachine:/timemachine odarriba/timemachine:latest

As with other dockers on Bellman, I set it to "restart always" to survive reboots.

Now you should be able to open TimeMachine settings on your Mac(s), select your Linux server and enter credentials, user "timemachine" and password "mysecretgoeshere" (or whatever you chose above) and you should be able select and start using the TimeMachine share.

To connect do Cmd-K and type in the URI for example afp://bellman/plover where bellman is the host and plover is the volume used in the add-account command

Explanation: I mount an 8TB drive formatted with btrfs as a single filesystem at /green. I put the local log file is in /var/log/timemachine. You have to use --net=host so that this docker can use avahi discovery; otherwise your Macs will not be able to find it in Timemachine. I set my own password to override the default "timemachine".

Since this Docker is built on Debian Jessie you can poke around in it by starting a shell if things don't look right,

docker exec -it timemachine /bin/bash

Update 2016

I used Tern for Timemachine backups for a few months. Go look at the page if you want details.

Update 2014

I built and used Netatalk 3 on Debian 6 but it turns out netatalk 2.2 works (in Debian 7). Since it is available in Debian 7 (aka Wheezy) you should upgrade your server and ignore the rest of this page!

Follow the instructions on this page instead: http://bullcreekstudio.com/uncategorized/debian-wheezy-mavericks-time-machine-server/

The outdated way

Build

Download source from http://sourceforge.net/projects/netatalk and build netatalk. Currently I am using 3.1.0

# install build prerequisites
sudo apt-get install build-essential libdb-dev
# download and unpack tar ball
# cd into source folder
./configure
make
sudo make install

Configure

Change the volumes to use extended attributes by editing /etc/fstab and add user_xattr to the options


This is my current afp.conf file

I used to start netatalk at boot by putting it in /etc/rc.local but then I installed the standard 2.2 package and removed it, and it left behind nice startup and config scripts that I recycled

apt-get install netatalk
apt-get remove netatalk

Edit /etc/init.d/netatalk Edit /etc/default/netatalk

bwilson@bellman:~$ cd /usr/local/etc
bwilson@bellman:/usr/local/etc$ cat afp.conf
;
; Netatalk 3.x configuration file
; manual: http://netatalk.sourceforge.net/3.0/htmldocs/

[Global]
log level = default:error
uam list = uams_guest.so uams_dhx.so
hosts allow = 192.168.123.108 192.168.123.109
vol preset = all_volumes
guest account = timemachine

[all_volumes]
file perm = 0664
directory perm = 0775
cnid scheme = dbd
valid users = julie bwilson

; [Homes]
; basedir regex = /home

[TimeMachine]
path = /green/timemachine
time machine = yes
valid users = timemachine