Setup Networked Time Machine Drive
Install samba and avahi-daemon. Samba shares the drive and avahi makes it work with apple (bonjour, etc)
sudo apt-get install samba avahi-daemon
Add user for time machine backups only and set password
sudo adduser timemachine
Take ownership of the drive
sudo chown -R timemachine: /mnt/TMDrive
Edit the Samba configuration file:
sudo nano /etc/samba/smb.conf
Contents of the file
[backups]
comment = Backups
path = /mnt/TMDrive
valid users = timemachine
read only = no
vfs objects = catia fruit streams_xattr
fruit:time machine = yes
More info about config files: https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html
More info about vfs_fruit: https://www.samba.org/samba/docs/current/man-html/vfs_fruit.8.html
Test Samba configuration
sudo testparm -s
Create a password for the samba drive
sudo smbpasswd -a timemachine
Restart the service to apply new config file
sudo service smbd reload
Modify the avahi config file:
sudo nano /etc/avahi/services/samba.service
Contents of the file:
<?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>sudo nano /etc/avahi/services/samba.service
Restart Avahi daemon:
sudo service avahi-daemon restart