Time Machine on TrueNas

andrema2

Explorer
Joined
Aug 3, 2011
Messages
83
Hi,

I've been using Time Machine for many years on FreeNas. It migrated to TrueNas without much problem. Today, for other reasons, I had to create a new pool and a new share for my Macs Time Machine backups.

I the past I used to create just one share and point all machines to that share. Each of those machines would create their sparsebundle and more recently I saw it have created a dataset.

Today, I wasn't able to create just one share and let the Macs do their thing. I have 3 machines, two High Sierras and one Catalina. The Catalina one was the first and was able to use the share and create it's dataset without me needing to do anything else. For the High Sierras it was not the case. It refused to connect, with permissions errors (that's my understanding). I had to create a dataset and a TM share for each machine and give the right permissions to be able to make it work.

Is it by default/design ? Is it possible to have just one share for all Machines ?

Thanks in advance
 

andrema2

Explorer
Joined
Aug 3, 2011
Messages
83
Since yesterday, the Mac that was able to create its own dataset (catalina OS) had to recreate the first back 3 times. The error message was "To improve reliability, Time Machine must create a new backup for you."

I've now created a share for this dataset and added
Code:
vfs objects=aio_fbsd tmprotect fruit streams_xattr shadow_copy_zfs ixnas
in the auxiliary option. Do you think it's ok now ?
 

JaimieV

Guru
Joined
Oct 12, 2012
Messages
742
I have just one share for all Macs, with a 4TB quota, and they seem to be happy with it. I get a "to improve reliability" once or twice a year across three Macs, and I just revert to an older snapshot of the TM dataset until it stops happening, ie before whatever corruption set in.

On first connection the TM System Prefs will ask for the username/pass necessary. I give them all the same user, the timemachine user that I created and set ACLs for the TM share for.

My TM shares have only the default vfs objects, ixnas streams_xattr

(When changing things, I have once had to go in to Keychain Access.app (/Applications/Utilities) and delete the saved login for the share, else the Mac is caching the old creds - it says "username or password incorrect" in this case but doesn't give you a way to correct it, thanks Apple)
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
Since yesterday, the Mac that was able to create its own dataset (catalina OS) had to recreate the first back 3 times. The error message was "To improve reliability, Time Machine must create a new backup for you."

I've now created a share for this dataset and added
Code:
vfs objects=aio_fbsd tmprotect fruit streams_xattr shadow_copy_zfs ixnas
in the auxiliary option. Do you think it's ok now ?
Can you PM me a debug from your server?
 

andrema2

Explorer
Joined
Aug 3, 2011
Messages
83
Can you PM me a debug from your server?
I just deleted everything and I'm trying to create it from the scratch. I didn't find a guide to do it on TrueNas 12.
I have 4 different Macs 2 with HIgh Sierra, 1 Catalina and 1 BigSur.
Let's see if I can make it and I'll let you know.

If there was a guide it would be perfect
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
I just deleted everything and I'm trying to create it from the scratch. I didn't find a guide to do it on TrueNas 12.
I have 4 different Macs 2 with HIgh Sierra, 1 Catalina and 1 BigSur.
Let's see if I can make it and I'll let you know.

If there was a guide it would be perfect
Create separate local user accounts for each of the Macs. Create a single time machine share with "enhanced time machine backup" preset. Use credentials and target for backups.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
This will automatically create datasets for each of the users when the macs first authenticate, and take snapshots of the dataset during clean disconnect so that you can rollback to previous versions of the sparsebundle volume on a per-mac basis in case it gets corrupted.
 

andrema2

Explorer
Joined
Aug 3, 2011
Messages
83
Here my testparm -s
Code:
Load smb config files from /usr/local/etc/smb4.conf
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
    aio max threads = 2
    bind interfaces only = Yes
    disable spoolss = Yes
    dns proxy = No
    enable web service discovery = Yes
    interfaces = 127.0.0.1 10.2.2.2
    kernel change notify = No
    load printers = No
    logging = file
    max log size = 51200
    netbios aliases = freenas
    nsupdate command = /usr/local/bin/samba-nsupdate -g
    registry shares = Yes
    restrict anonymous = 2
    server role = standalone server
    server string = FreeNAS Server
    unix extensions = No
    idmap config *: range = 90000001-100000000
    fruit:nfs_aces = No
    idmap config * : backend = tdb
    directory name cache size = 0
    dos filemode = Yes
    strict sync = No


[NAS]
    ea support = No
    kernel share modes = No
    path = /mnt/NAS
    posix locking = No
    read only = No
    vfs objects = aio_fbsd fruit streams_xattr shadow_copy_zfs ixnas
    fruit:resource = stream
    fruit:metadata = stream
    nfs4:chown = true


[TM]
    ea support = No
    kernel share modes = No
    path = /mnt/TM/%U
    posix locking = No
    read only = No
    vfs objects = aio_fbsd tmprotect fruit streams_xattr shadow_copy_zfs ixnas
    ixnas:default_user_quota = 1T
    ixnas:zfs_auto_homedir = true
    fruit:locking = none
    fruit:time machine = yes
    fruit:resource = stream
    fruit:metadata = stream
    nfs4:chown = true


I just sent you in the PM the debug
 

andrema2

Explorer
Joined
Aug 3, 2011
Messages
83
This will automatically create datasets for each of the users when the macs first authenticate, and take snapshots of the dataset during clean disconnect so that you can rollback to previous versions of the sparsebundle volume on a per-mac basis in case it gets corrupted.
Ok. Destroing what I did, that it's different and creating a new one as you suggested
 

andrema2

Explorer
Joined
Aug 3, 2011
Messages
83
Create separate local user accounts for each of the Macs. Create a single time machine share with "enhanced time machine backup" preset. Use credentials and target for backups.
I don't have an "enhanced time machine backup" preset. I have a Multiuser Time Machine. Is it the same ? I'm missing something ?
 

andrema2

Explorer
Joined
Aug 3, 2011
Messages
83
I created a share with Multi User Time Machine preset.

I've started the TM on all four machines. This is what I see at the Pool

Screen Shot 2020-10-23 at 15.49.53.jpg

TM is the share. Andre is my user, no machine is connecting to the TM share as Andre, but they connect to other shares at the same server using this user. The four datasets below the Andre dataset belongs to each machine. Strangely, to me at least, the data seems to be save on the first dataset only. I believe it might be causing the issues.
 

dak180

Patron
Joined
Nov 22, 2017
Messages
308
This will automatically create datasets for each of the users when the macs first authenticate, and take snapshots of the dataset during clean disconnect so that you can rollback to previous versions of the sparsebundle volume on a per-mac basis in case it gets corrupted.
What is the best way to set this up on an existing share/dataset that predates 12?
 

andrema2

Explorer
Joined
Aug 3, 2011
Messages
83
I still have issues with my Time Machine. Every time that TrueNas restarts, TM shares are not visible to the Macs. I can use the other SMB shares but not the TM SMB share. I have to stop and start the SMB service for it make the share visible again.

Has anyone facing it too ?
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,545
I still have issues with my Time Machine. Every time that TrueNas restarts, TM shares are not visible to the Macs. I can use the other SMB shares but not the TM SMB share. I have to stop and start the SMB service for it make the share visible again.

Has anyone facing it too ?
Known issue on some servers (race condition with avahi config generation). You can add an post-init script to restart mdns "midclt call service.restart mdns" or wait for the U1 update.
 

Oded

Explorer
Joined
Apr 20, 2014
Messages
66
I'm facing a similar issue (I think).
I setup a "backups" dataset.
I create two users: imac and macmini, both under the group "home".
I also have a "nas" user under the group "home" for other sharing use cases.
ACL for "backups" dataset is set to "nas/home".
I created a Time Machine share for "backups".
I connected from the iMac and from the Mac Mini with their respective users. Each created a dataset under "backups".
However - they don't really backup to their respective data sets, they backup to a new dataset under "backups" called "nas".

I tried a different approach - created a share per machine, each pointing directly at the correct data set.
Still, it created TWO separate datasets under each one, one with the username and another one called "nas":

Screen Shot 2020-12-17 at 14.53.14.png


At least now it is backup up to the "imac/imac" dataset, but this is still messy and not as I would have liked: I want two datasets under "backups", one per machine, I can connect to them through the same user "nas" if needed, doesn't matter to me, but I want them to backup correctly.
 

Oded

Explorer
Joined
Apr 20, 2014
Messages
66
I eventually destroyed the backups dataset and started from scratch. Seems to be better now, no clue what is different though.
Hopefully the backup will finish successfully now.

Screen Shot 2020-12-17 at 15.21.57.png
 

colinng

Cadet
Joined
Oct 1, 2012
Messages
6
What is the best way to set this up on an existing share/dataset that predates 12?


TrueNAS is pretty strict when it comes to using a dataset named with <username>.

I previously had separate SMB shares for each person who wanted Time Machine backups.

Before (FreeNAS 11.3):
Code:
OldPool  # Pool
  tm_colinng  # the old dataset for my Time Machine backup
  tm_someoneElse


I built a new array and used ZFS replication to copy everything from OldPool to NewPool.
If you are updating, try zfs snapshot <Pool>/<Dataset> to make a snapshots of each dataset. (This saved me a lot of grief when experimenting!)

After ZFS replication (TrueNAS 12.0):
Code:
NewPool  # Pool
  tm_colinng  # will use zfs rename on this
  tm_someoneElse


Rename the old backup dataset to just your username.
Code:
zfs rename NewPool/tm_colinng NewPool/colinng


After ZFS rename:
Code:
NewPool  # Pool
  colinng # the dataset has been renamed to match the username
  tm_someoneElse


Setting up the SMB Time Machine share
  1. Add a new SMB share with
    • Purpose: Multi-user time machine.
    • Path: (the parent folder of the Time Machine dataset, in my case /mnt/NewPool)
  2. Connect to the new share from macOS. TrueNAS will see there is already a dataset with your username, and serve that up. In macOS you will see your old backup:
    • macName.backupbundle
    • macName.purgeable.sparsebundle
  3. In System Preferences > Time Machine, specify this new share as your backup:
    • choose Select Disk..., and specify the new share
    • if you have multiple backups, choose Add or Remove Backup Disk, and specify the new share
  4. Time Machine will do an incremental backup to the new share, keeping your backup history!
My first new backup did take a long time (30 minutes?) in the Cleaning up... phase, but it succeeded, and I kept my backup history.
 
Last edited:

colinng

Cadet
Joined
Oct 1, 2012
Messages
6
TrueNAS is pretty strict when it comes to using a dataset named with <username>.

Gee, trust me to make this so complicated. I actually didn't need to do any of that renaming and stuff.

Just create the SMB share, use Purpose: No Preset, ADVANCED OPTIONS, check Time Machine.
Then connect to the share, verify you can see your old macName.backupbundle, then tell Time Machine to back up to it.

1609932826880.png


This basically creates the same as the Multi-user time machine but with no Path Suffix. The Path Suffix is what specifies the <username> dataset.
 

andrema2

Explorer
Joined
Aug 3, 2011
Messages
83
I don't know what is the deal in my case.

Of 4 Macs, I have only a problem with my "Corporate" one. It's a Catalina MacBook. The others are 2 High Sierras and 1 BigSur. These 3 does the backups and don't give me any grief. The Catalina one has frequent failures and need to have its TM started all over. I just deleted its dataset and it's starting again. I'm not sure if it is the parameters under the dataset that needs to be different...
By the way, I had to move back to TrueNas 12.0 because of SMB exiting on U1.
 
Top