@mercenary_sysadmin Okay, so, I double-checked over on the Lawrence Systems forums, as I know he uses TrueNAS a lot and manages to make its CLI obey him.
Turns out it was a me and SMB problem, but I’m going to mostly blame SMB. 
tl;dr: Strip the permissions on the rsync
.
There shouldn’t have been anything wrong with using rsync exactly the way I was trying to. So, I went and stared at the man page and actually tried to make myself understand the -a
flag a bit better. And one of the things it does is preserve permissions … which, in retrospect, explains exactly why this was choking.
The data originally came off of a Mac OS filesystem (Mac OS permissions!), was synced to an SMB share on an ext4-based QNAP (SMB permissions + ext4-based Linux permissions!) and then rsync’d over SMB from the QNAP to the evac dataset on the TrueNAS (…?! permissions!).
And rsync tends to choke on SMB permissions, from what I’ve read today.
And the error was permission denied on write, so I assume ZFS decided that no, you’re not writing that mish-mash to my beautiful datasets, thank you.
So, I still wanted to preserve as much as I could, in particular any Mac OS hardlinks and as much metadata (dates, Mac OS extended attributes, etc.) as I could. But I couldn’t copy the permissions.
A bit more studying of the man page, and…
rsync -hav -H --no-perms --progress --stats --exclude=.DS_Store
It works.
Number of files: 171,055 (reg: 123,979, dir: 47,076)
Number of created files: 171,055 (reg: 123,979, dir: 47,076)
Number of deleted files: 0
Number of regular files transferred: 123,979
Total file size: 58.25G bytes
Total transferred file size: 58.25G bytes
Literal data: 58.25G bytes
Matched data: 0 bytes
File list size: 9.37M
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 58.28G
Total bytes received: 2.60M
sent 58.28G bytes received 2.60M bytes 146.99M bytes/sec
total size is 58.25G speedup is 1.00
ETA: After the rsync
works, check your file permissions on the CLI in the target directory.
The files I copied over ended up with the correct group for the target dataset, but still had the (now incorrect) user for the source dataset. a quick sudo chown -R $user:$group $dir
fixed that right up. 
ETA 2:
I was trolling the TrueNAS SCALE documentation trying to get a better understanding of the ACL options while setting up a dataset, and accidentally ended up in the Permissions/ACL documentation for CORE, at Permissions | TrueNAS Documentation Hub.
I’m glad I did, as it contains this text on ACL types and their relation to how SMB works, which is not in the documentation for SCALE, as far as I can tell:
Access Control Lists
An Access Control List (ACL) is a set of account permissions associated with a dataset and applied to directories or files within that dataset. ACLs are typically used to manage user interactions with shared datasets and are created when a dataset is added to a pool.
When creating a dataset, you can choose how the ACL can be modified by selecting an ACL Mode:
- Passthrough only updates ACL entries (ACEs) that are related to the file or directory mode.
- Restricted does not allow
chmod
to make changes to files or directories with a non-trivial ACL. An ACL is trivial if it can be fully expressed as a file mode without losing any access rules. Setting the ACL Mode to Restricted is typically used to optimize a dataset for SMB sharing, but can require further optimizations. For example, configuring an rsync task with this dataset could require adding --no-perms
as an extra option for the task.
Emphasis added to the last sentence there. If I’d found this right off, it would’ve saved me about half a day of troubleshooting (and I probably wouldn’t have posted this thread).
This was the exact issue I was experiencing with rsync
on a share configured with the SMB preset (which is the only one that uses the Restricted
ACL type): rsync failed until --no-perms
was included in the command.
Now I’m a bit paranoid about how much useful information is in the CORE documentation that I’m not seeing because I’m using the SCALE docs… I’ll have to start checking them both. I’m not going to assume that they’ll have information parity someday.