Set up Samba to better support Mac and Time Machine

I bought my own home tower server about 2 months ago on sale. The main role of this server is NAS for all my devices. I have two computers running Mac OS and it’s going to be very convenient if the NAS server can serve as Time Machine for backing up them. It turns out that Samba has native support for that. The related settings are as shown below. This includes both optimization for Mac and the support for Time Machine.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[Global]
min protocol = SMB2
vfs objects = catia fruit streams_xattr
fruit:metadata = stream
fruit:model = MacSamba
fruit:posix_rename = yes
fruit:veto_appledouble = no
fruit:wipe_intentionally_left_blank_rfork = yes
fruit:delete_empty_adfiles = yes

[TimeMachineBackup]
vfs objects = catia fruit streams_xattr
fruit:time machine = yes
# path = /path/to/your/backup/folder ### put settings the same way as you would for a regular samba folder
# valid users ......

Reference to samba wiki