Use a Raspberry Pi 4 for Time Machine (works with macOS 12 Monterey)


Update system software

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

Install Samba

sudo apt-get install samba avahi-daemon


Connect Hard drive to USB 3.0 port

Determine the device ID (UUID) of your USB drive

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

Create backup user

sudo adduser timemachine

Set a password

sudo smbpasswd -a timemachine

Create mount point

sudo mkdir /mnt/timemachine

Mount device

sudo mount /dev/sdb1 /mnt/timemachine

Take ownership

sudo chown -R timemachine: /mnt/timemachine

Configuring Samba

sudo nano /etc/samba/smb.conf
comment = Backups
path = /mnt/timemachine
valid users = timemachine
read only = no
vfs objects = catia fruit streams_xattr
fruit:time machine = yes

Test Samba configuration

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

Restart service

sudo service smbd reload

Test connection to your Time Machine


Configuring Avahi deamon

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

Restart Avahi daemon:

sudo service avahi-daemon restart

Automate things

Automated mount on boot

sudo nano /etc/fstab
UUID=7efbdfc5–9c85–4e01–873a-204e00c9aa45 /mnt/timemachine ext4 sync,noexec,nodev,noatime,nodiratime 0 0

Automated start of the services

sudo crontab -e
@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

Choose volume

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

Use your password

It will ask for your earlier set password

Enjoy backuping

Backuping to my Raspberry Pi Time Machine Server



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