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

Preparation

Update system software

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

Install Samba

sudo apt-get install samba avahi-daemon

Storage

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
7efbdfc5–9c85–4e01–873a-204e00c9aa45

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
[backups]
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

smb://192.168.1.150/backups

Configuring Avahi deamon

sudo nano /etc/avahi/services/samba.service
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_smb._tcp</type>
<port>445</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>9</port>
<txt-record>model=TimeCapsule8,119</txt-record>
</service>
<service>
<type>_adisk._tcp</type>
<port>9</port>
<txt-record>dk0=adVN=backups,adVF=0x82</txt-record>
<txt-record>sys=adVF=0x100</txt-record>
</service>
</service-group>

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

--

--

--

Sascha Eggenberger. Senior User Experience Designer @unic @Drupal Contributor. Drupal Design System, Claro, Gin. #OpenSource https://sascha.is/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Pragmatic Guide to Learning Python (Part 1: Random Thoughts)

Extensions Launch Update — Analytics

Transactions Categorization

Bitrise with Xamarin

Chapter 8 Streaming with Pipes and Files

Learn How XCTest Manages Test Cases

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
Sascha Eggenberger

Sascha Eggenberger

Sascha Eggenberger. Senior User Experience Designer @unic @Drupal Contributor. Drupal Design System, Claro, Gin. #OpenSource https://sascha.is/

More from Medium

A criminally short guide to installing polybar on Ubuntu 20.04

Raspberry pi

Add colourful current working git branch names on the Linux terminal

A New Type of Internet