Create timemachine share in TrueNAS
Note: I got issue suddenly after sometimes, and spent hours to fix it. End up, I switched back to Synology NAS as timemachine. Check Update section.
Tried many hours on setting up time machine backup in TrueNAS Scale, encountered many issues. To save time next time, record important steps and parameters for for next setup.
Create a dataset called
timemachine under zpool
pool1. Set ACL Type of dataset to
Creating new user/group is not a good way if the NAS is also used for other user from same machine at same time. This is because the TrueNAS will use both user to login, which is hard to troubleshoot and confusing. If do not create new user, the ownership/permission of sharing dataset is also hard to decide. To use dedicated user for timemachine, following steps can be used.
Create a new named as user id
tm with group
tm. It will create a sub-dataset in ZFS under timemachine dataset. Change home directory of
tm to the dataset created in Create dataset section.
The Auxiliary Groups have a group named as
builtin_users. Beware of this group, it will appear later in this post again.
Note: If the backup folder was copied from other system, change the owner/group to
tm:builtin_users, and permission to
775 to avoid permssion issue.
Set permission of dataset
This is most easy way with lesser headache. Remove ACL if ACL is wong or just use traditional UNIX permission system.
Change owner and group to both
The dataset permission set to
POSIX_HOME, this will enable owner and group both have read/write/execute permission, others will be read only.
In TrueNAS, the actual implementation for time machine done by option in SMB sharing, named Multi-user time machine, so select Multi-user time machine as Purpose, otherwise, Time Machine option will not be set and it is unchangable.
Beware of option Time Machine is selected, and Path Suffix is set to
%U, both are unchangable. The
%U means, a sub-dataset will be created under shared dataset for each user, they will not share the same view.
The individual host to be backed up will create a folder
<hostname>.sparsebundle, which will be shown as disk in MacOS.
If got strange issue on permission, uncheck ACL in SMB sharing, and then restart SMB service.
Note: The error can be verified by using Windows access share drive.
The actual file created in sub-dataset, will be under
builtin_users group with permission
tm for unknown reason. Sample output is shown below.
truenas# ls -la /mnt/pool2/timemachine/tm total 70 drwxrwx---+ 3 tm tm 4 Oct 3 22:32 . drwxrwxr-x+ 6 tm tm 6 Oct 3 21:23 .. -rwxrwx---+ 1 tm builtin_users 6148 Oct 3 21:32 .DS_Store drwxrwx---+ 4 tm builtin_users 10 Oct 3 23:02 shark.sparsebundle truenas#
Suddently, timemachine on TrueNAS stopped working, error message shows macOS could not find server.
I tried to manually map SMB drive, but failed too. I could not access the timemachine shared folder, but rest of shared folders are accessible.
During the troubleshooting, found that macOS could not see TrueNAS in Finder, the issue could be related to mDNS missing.
The following settings make timemachine work again.
- Purpose: Multi-user time machine
- Enable ACL
- Browsable to Network Clients
- Time Machine (Can not change)
- Legacy AFP compatibility
- Enable Shadow Copies
- Enable Alternate Data Streams
- Enable SMB2/3 Durable Handles
But the the shared folder still requires to be opened before macOS Time Machine can see it. So, mDNS issue is still there.