Skip to content

Instantly share code, notes, and snippets.

@cfstras
Last active February 21, 2024 16:01
Show Gist options
  • Save cfstras/56ae8db3f7c33d8a583c6578b1c91096 to your computer and use it in GitHub Desktop.
Save cfstras/56ae8db3f7c33d8a583c6578b1c91096 to your computer and use it in GitHub Desktop.

Time Machine backups via SMB

Cobbled together from https://www.reddit.com/r/homelab/comments/83vkaz/howto_make_time_machine_backups_on_a_samba/

  1. Have at least Samba 4.8
  2. create /etc/avahi/services/timemachine.service (see avahi.xml)
  3. edit /etc/samba/smb.conf (see smb.conf)
    • I only added one path and one valid user, your choice
zfs create tank/backup/$USER/timemachine
zfs set quota=1T tank/backup/$USER/timemachine
systemctl restart avahi-daemon
systemctl restart smb
  1. Go to your time machine config, it should be there!
<?xml version="1.0" standalone='no'?>
<!-- /etc/avahi/services/timemachine.service -->
<!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>0</port>
<txt-record>model=RackMac</txt-record>
</service>
<service>
<type>_adisk._tcp</type>
<txt-record>sys=waMa=0,adVF=0x100</txt-record>
<txt-record>dk0=adVN=TimeMachine Home,adVF=0x82</txt-record>
</service>
</service-group>
# /etc/samba/smb.conf
[global]
#...
# Special configuration for Apple's Time Machine
fruit:model = MacPro
fruit:advertise_fullsync = true
fruit:aapl = yes
## Define your shares here
[TimeMachine Home]
path = /tank/backup/%U/timemachine/
valid users = %U
writable = yes
durable handles = yes
kernel oplocks = no
kernel share modes = no
posix locking = no
vfs objects = catia fruit streams_xattr
ea support = yes
browseable = yes
read only = No
inherit acls = yes
fruit:time machine = yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment