Use a Raspberry Pi 4 for Time Machine (works with macOS 11 Big Sur)

Time Machine is built into the system of macOS and I’m using it since the early days of Mac OS X Leopard. If you have a Raspberry Pi (or two) lying around at your place like me, this tutorial comes in handy to create a cheap and speedy backup solution.


Make sure your Raspberry Pi is running on the latest software.

sudo apt-get update && sudo apt-get upgrade

We’re going to first install Samba (for SMB) which is a very popular Open Source file sharing protocol which is officially supported by Time Machine for backing up data over a network. The Avahi daemon is used for Apples “Bonjour” mDNS protocol that our Raspberry Pi server is automatically discoverable within the network.

sudo apt-get install samba avahi-daemon


As the Raspberry Pi 4 ships with 2x USB 3.0 ports we can connect an external hard drive as our disk space for backing up data. Also we should get decent speeds as we also get a 1GBit/s wired connection with the Pi 4.

ls -lha /dev/disk/by-uuid
Look for the UUID and rember the mount point (e.g. /dev/sdb1) we’ll need this later

In my case the device was /dev/sdb1 and the UUID we’re looking for was the one below:


Note: exchange this UUID with yours

Create backup user

sudo adduser timemachine

It will ask to set a password for your newly created user.

sudo smbpasswd -a timemachine

Create mount point

In order to mount the USB hard drive we need to create a folder where Linux can mount our device to.

sudo mkdir /mnt/timemachine

We’ll now mount the USB drive to the previously created mount point.

sudo mount /dev/sdb1 /mnt/timemachine

Note that you’ll need to exchange /dev/sdb1 with your device (see the Step with the the UUID above which letter your device uses)

To allow our backup user to write on the device we’ll need to take over the ownership of the mount point:

sudo chown -R timemachine: /mnt/timemachine

Configuring Samba

Edit the Samba configuration file:

sudo nano /etc/samba/smb.conf

add the following to the end:

comment = Backups
path = /mnt/timemachine
valid users = timemachine
read only = no
vfs objects = catia fruit streams_xattr
fruit:time machine = yes

This will create a network drive called “backups” which we’ll use for Time Machine.

sudo testparm -s
If all goes well you should get an output like this

Not let’s restart the service to make sure our changes are active.

sudo service smbd reload

On your Mac press “Command + K” on your desktop which will open the “Connect to Server” prompt. Type in the IP Address of your Pi followed by the /backups to connect to our Time Machine volume.


Now you should be connected to your Time Machine volume.

Configuring Avahi deamon

In order to let MacOS automatically detect our new Time Machine we’ll need to configure Avahi. For that edit the following file:


And paste this configuration in:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<name replace-wildcards="yes">%h</name>

With this we tell MacOS that in fact our Raspberry Pi is a 8th Gen Time Capsule and it will appear like one in the sidebar in Finder.

sudo service avahi-daemon restart

Automate things

We need to tell fstab that it mounts our hard drive to the Raspberry Pi.

sudo nano /etc/fstab

We need to append the UUID from above like this:

UUID=7efbdfc5–9c85–4e01–873a-204e00c9aa45 /media/tm hfsplus force,rw,user,noauto 0 0

We need to edit crontab with:

sudo crontab -e

We’ll mount the USB drive and start the needed services on a boot/reboot:

@reboot sleep 30 && mount /mnt/timemachine && sleep 30 && umount /mnt/timemachine && sleep 30 && mount /mnt/timemachine && sleep 30 && service avahi-daemon start && service smbd start

Setup Time Machine

The first step is to choose our “backups” volume. For that open the Time Machine settings and you’ll find it under “Available disks”:

Let’s choose our “backups” volume on the Raspberry Pi

Use your password to connect to the Raspberry Pi Time Machine volume:

It will ask for your earlier set password

and we’re done! Happy backuping!

Backuping to my Raspberry Pi Time Machine Server

Sascha Eggenberger. Senior User Experience Designer @unic @Drupal Contributor. Drupal Design System, Claro, Gin. #OpenSource

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store