Setup Samba on ZFS for MacOS Time Machine

Notes on setup

This should be rewritten in Ansible, but for now these are the commands.

Create a zpool. I named mine backups. Disable access-times and enable the SMB share.

zfs set atime=off tanker/backups
zfs set sharesmb=on tanker/backups

Install Samba if you have not already. apt-get install samba Backup your default smb.conf. cp /etc/samba/smb.conf /etc/samba/smb.conf.ORIG Edit /etc/samba/smb.conf and add the following:

  workgroup = your-cool-workgroup
  usershare max shares = 100
  usershare allow guests = no
    comment = Time Machine
    path = /tanker/backups/timemachine
    browseable = yes
    writeable = yes
    create mask = 0600
    directory mask = 0700
    spotlight = yes
    vfs objects = catia fruit streams_xattr
    fruit:aapl = yes
    fruit:time machine = yes

Create the timemachine directory that will store your timemachine backups.

mkdir /tanker/backups/timemachine
chown msnow:msnow /tanker/backups/timemachine

Add user and password: smbpasswd -a msnow

Restart smbd and nmbd: systemctl restart smbd && systemctl restart nmbd

Status of Samba commands

cat /var/lib/samba/usershares/tanker_backups

View Samba Users

pdbedit -L

net usershare list