inherited property would be the same at the destination. This can occur
when replicating partial dataset trees without the parents that set the
property locally.
syncoid --preserve-properties preserves locally set properties but not inherited properties that would be not be inherited at the destination. Example:
tank local acltype=posix (default for TrueNAS pools)
tank/home local acltype=nfsv4
tank/home/evan inherits local acltype=nfsv4
tank/home/evan/Documents inherited acltype=nfsv4
backup local acltype=posix (default for TrueNAS pools)
syncoid --recursive --preserve-properties tank/home/evan backup/evan
replicates the datasets but with acltype inherited from backup = posix, and not acltype=nfsv4 as was inherited from tank/home.
The desired result in this case would be to set acltype=nfsv4 locally on backup/evan and inherit acltype on backup/evan/music. It would also need to preserve some settings that are intended to be different, for example setting copies=2 on backup, or excluding mountpoint.
This PR implements a new command line option --preserve-inherited-properties that preserves properties where they were inherited in their source location but would not otherwise be inherited in their destination.
Real output in my enviroment after running syncoid syncoid --recursive --preserve-inherited-properties --recvoptions="u o readonly=on x mountpoint" tank backup
> zfs get acltype,mountpoint,readonly -r backup -t fs
NAME PROPERTY VALUE SOURCE
backup acltype posix local
backup mountpoint /mnt/backup local
backup readonly off default
backup/tank acltype posix local
backup/tank mountpoint /mnt/backup/tank inherited from backup
backup/tank readonly on local
backup/tank/home acltype nfsv4 local
backup/tank/home mountpoint /mnt/backup/tank/home inherited from backup
backup/tank/home readonly on local
backup/tank/home/evan acltype nfsv4 inherited from backup/tank/home
backup/tank/home/evan mountpoint /mnt/backup/tank/home/evan inherited from backup
backup/tank/home/evan readonly on local
backup/tank/home/evan/Documents acltype nfsv4 inherited from backup/tank/home
backup/tank/home/evan/Documents mountpoint /mnt/backup/tank/home/evan/Documents inherited from backup
backup/tank/home/evan/Documents readonly on local
This change:
- adds --preserve-inherited-properties command line option with --help
- implicitly sets --preserve-properties if --preserve-inherited-properties is set
- renames getlocalzfsvalues to getzfspropertiestopreserve to reflect its purpose
- returns local and inherited properties if --preserve-inherited-properties is set, otherwise local properties only
- skips propeties that are set or excluded in recvoptions
- skips properties that would be inherited correctly at the destination unless they were locally set at the source
- adds keylocation to blacklist (along with other encryption-related properties)
If --insecure-direct-connection contained 4 parts (including the
',mbuffer' at the end), the 3rd part (timeout) was silently ignored
and left at the default 60s.
Do not ignore the timeout part even in directmbuffer mode.
The `runsynccmd` subroutine was not matching the `$sendsource` when a
receive resume token is passed in. All usages that pass in the receive
resume token do not begin with a space; instead, they start with `-t `.
Fixes: https://github.com/jimsalterjrs/sanoid/issues/918
Add the zstdmt-fast and zstdmt-slow compress options to allow use of
multithreading when using zstd compression.
Signed-off-by: 0xFelix <felix@matouschek.org>
This is a continuation of a previous commit to sort snapshots by
`createtxg` if possible. Now, we have to match the behavior when
selecting an appropriate snapshot based on the transaction group of the
relevant bookmark in `syncdataset()`.
Supersedes: https://github.com/jimsalterjrs/sanoid/pull/667
It is possible for `creation` of a subsequent snapshot to be in the past
compared to the current snapshot due to system clock discrepancies,
which leads to earlier snapshots not being replicated in the initial
syncoid sync.
Also, `syncoid --no-sync-snap` might not pick up the most recently taken
snapshot if the clock moved backwards before taking that snapshot.
Sorting snapshots by the `createtxg` value is reliable and documented
in `man 8 zfsprops` as the proper way to order snapshots, but it was not
available in ZFS versions before 0.7. To maintain backwards
compatibility, the sorting falls back to sorting by the `creation`
property, which was the old behavior.
Fixes: https://github.com/jimsalterjrs/sanoid/issues/815
The `getsnaps` subroutine now retrieves the "createtxg" property of the
snapshot.
This is necessary to support the fix for
https://github.com/jimsalterjrs/sanoid/issues/815 (Syncoid: Data loss
because getoldestsnapshot() might not choose the first snapshot).
* The part that was "a little obnoxious" has been rewritten to extract
the desired properties in a single loop after importing each line into
a hash rather than processing line by line with a state tracking flag.
* The `getsnapsfallback` subroutine had duplicated logic that has been
absorbed into `getsnaps` with a recursion argument to enable the
fallback mode.