Setting Up a Raspberry Pi as a Time Machine Backup Server with Netatalk
macOS's Time Machine wants a network destination that speaks either AFP (the legacy Apple Filing Protocol) or, more commonly on modern macOS, SMB with a specific set of Apple extensions enabled. A commercial network drive that advertises "Time Machine compatible" is really just a Linux box running Netatalk or a correctly-configured Samba build under the hood — and a Raspberry Pi with an external drive can do exactly the same job for a fraction of the price of a dedicated Time Capsule-style appliance, which Apple stopped making years ago anyway. This guide covers both paths: Netatalk (AFP), which is the traditional and still rock-solid route, and modern Samba with Time Machine extensions, which is what Apple itself has been pushing toward since deprecating AFP support.
Which Protocol Should You Use?
ProtocolmacOS supportNotes AFP via NetatalkWorks on all modern macOS versions, though Apple has deprecated AFP client support in its own roadmapMature, well-documented, the traditional choice — still widely used and reliable today SMB via Samba with vfs_fruitApple's current recommended path; required for some newer macOS Time Machine behaviorsNeeds specific Samba configuration (the fruit VFS module) to expose the metadata and resource-fork behavior Time Machine expects — a plain Samba share won't work correctlyEither works well on a Pi. This guide walks through Netatalk since it remains the simpler, more predictable setup for a dedicated backup target, with the Samba/vfs_fruit alternative noted where the steps diverge.
Hardware and Storage
Time Machine backups are read/write-heavy and grow continuously, so plan storage accordingly — a rule of thumb is at least 2-3x the size of the data you're backing up, to give Time Machine room for its incremental snapshot history before it starts pruning old backups. A USB 3.0 external SSD is strongly preferred over a spinning HDD or, worse, an SD card: Time Machine hourly backups involve a lot of small, random writes, and an SD card will both perform poorly and wear out fast under that pattern. A Pi 4 or Pi 5 with a proper USB 3.0 port and an externally powered drive (don't rely on Pi USB bus power for a mechanical drive) is the right baseline — see our Powering a Raspberry Pi Right guide if you're also running this Pi headless off a UPS HAT.
Setting Up the Drive
Format the external drive as ext4 for the best Linux-native performance and reliability under Netatalk's file locking model. Mount it at a consistent path via /etc/fstab using the drive's UUID rather than its device name (device names like /dev/sda1 can shift if you ever add a second USB drive), so the mount survives reboots reliably:
UUID=xxxx-xxxx /mnt/timemachine ext4 defaults,nofail 0 2Installing and Configuring Netatalk
Install Netatalk from your distro's package repository (recent Raspberry Pi OS releases carry Netatalk 3.x, which has native Time Machine support built in — you don't need the manual mimic-Time-Capsule hacks that older guides describe). The key config lives in /etc/netatalk/afp.conf:
[Time Machine Backup] path = /mnt/timemachine time machine = yes valid users = pibackupCreate a dedicated backup user (don't reuse your general admin account) with adduser pibackup, set an AFP-compatible password, and restart the Netatalk service. The time machine = yes directive is what makes this specific share discoverable by macOS as a Time Machine destination via Bonjour/mDNS, rather than showing up as just another generic network share.
Advertising the Share via Bonjour
Netatalk 3 on a properly configured Avahi setup advertises itself automatically, but if your Pi's Time Machine share isn't showing up in System Settings on the Mac, check that Avahi (avahi-daemon) is running and that a service definition for _afpovertcp._tcp exists — most distro Netatalk packages install this by default, but it's worth confirming if discovery isn't working.
Setting a Quota (Recommended)
Left unbounded, Time Machine will happily consume an entire drive over time. Netatalk supports a volume size limit in the same share stanza:
[Time Machine Backup] path = /mnt/timemachine time machine = yes vol size limit = 500000The limit is specified in MB. Setting a hard cap prevents one Mac's backup history from silently filling a drive you intended to share across multiple machines, and it gives Time Machine a defined boundary so it manages its own pruning predictably instead of running the drive to zero free space.
Connecting from macOS
Open System Settings → General → Time Machine → Add Backup Disk, and the Pi's share should appear listed by the name given in the config stanza. Select it, authenticate with the dedicated backup user's credentials, and the first backup will run — expect it to take a while over Wi-Fi for a full initial backup; wired Ethernet to the Pi is worth the extra cable for that first pass if the data set is large.
The Samba/vfs_fruit Alternative
If you'd rather stay on SMB (useful if this Pi is also serving Windows or Linux clients from the same share and you don't want to run two file-sharing daemons), Samba needs the fruit and streams_xattr VFS modules enabled per-share along with fruit:time machine = yes in smb.conf, plus ea support = yes and appropriate xattr handling on the underlying filesystem. It's a slightly fussier configuration to get exactly right than Netatalk's dedicated Time Machine flag, but it's the path Apple's own guidance points toward for new setups, and it means one Samba install can serve Time Machine, Windows, and general Linux clients from the same box.
Reliability Notes
- Give the Pi a static IP or a DHCP reservation — Time Machine can lose track of a backup destination that changes address, leading to a "backup disk not found" error and, in bad cases, a forced fresh full backup.
- If this Pi does double duty as your general home NAS (see our Build a Raspberry Pi NAS with Samba File Sharing project for the general-purpose version), keep the Time Machine volume on its own dedicated partition or drive rather than sharing free space with other data — Time Machine's aggressive space usage and pruning behavior doesn't play well sharing headroom with other services.
- Monitor drive health periodically with smartctl — a backup drive that silently fails is worse than no backup at all, since it creates false confidence.
A Pi running Netatalk is functionally what a Time Capsule always was — a small headless Linux box with a hard drive and a specific network service — minus the Apple markup and with the added benefit of being a general-purpose Linux box you can extend for other things later. It's a genuinely low-maintenance way to get real, automatic, versioned Mac backups onto hardware you already understand.
Related Guides
- Build a Raspberry Pi NAS with Samba File Sharing
- How to Install Klipper on Any 3D Printer: Complete Setup Guide
- How to Set Up OpenCV Machine Vision on a Raspberry Pi
- Raspberry Pi: Complete Headless Setup Guide (No Monitor Needed)
- Raspberry Pi: Headless OS Setup
- How to Set Up a Raspberry Pi Headless with SSH and WiFi
- How to Install and Configure Pi-hole on Raspberry Pi
- How to Control GPIO Pins on Raspberry Pi with Python