Commit Graph

367 Commits

Author SHA1 Message Date
evan314159 f6f0ba7c37
Merge 385da8bd49 into 2c98f0501c 2025-08-24 16:19:52 +00:00
Jim Salter a6728e48de
Merge pull request #996 from jjakob/fix_directtimeout
syncoid: fix directtimeout in directmbuffer mode
2025-08-24 10:56:44 -04:00
Evan 385da8bd49 When preserving inherited properties, also verify that the value of the
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.
2025-06-28 18:05:13 +08:00
Evan da5b10b722 syncoid: preserve inherited properties
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)
2025-06-28 16:02:37 +08:00
Christoph Klaffl becec66320
prepare v2.3.0 2025-06-09 23:21:44 +02:00
Adam Fulton aa2c693e62
fix(syncoid): regather $snaps on --delete-target-snapshots flag 2025-06-05 23:31:47 +02:00
Christoph Klaffl b794da6f14
Revert "Merge pull request #818 from Deltik/fix/815"
This reverts commit 7c225a1d7b, reversing
changes made to acdc0938c9.
2025-06-05 23:23:30 +02:00
Christoph Klaffl f0a2b120d9
Merge branch 'blacklist-encryption' into prepare-2.3.0 2025-06-05 22:42:49 +02:00
Christoph Klaffl a546b7d162
Merge branch 'fix-warning' into prepare-2.3.0 2025-06-05 22:42:22 +02:00
Christoph Klaffl 6bda64508b
Merge branch 'ossimoi/master' into prepare-2.3.0 2025-06-05 22:39:38 +02:00
Jernej Jakob 749490830f
syncoid: fix directtimeout in directmbuffer mode
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.
2025-03-31 14:54:46 +02:00
Christoph Klaffl 7062b7347e
blacklist encryption property from preserving 2025-01-24 14:01:59 +01:00
Christoph Klaffl 4a9db9541d
fix warning in edge cases ("Use of uninitialized value in numeric comparison") 2024-12-03 19:32:47 +01:00
Ossi A b27b120c19 syncoid: add -X send option in special options 2024-06-25 11:11:29 +03:00
Nick Liu fab4b4076c
fix(syncoid): `zfs send` arg allowlist when sendsource is receivetoken
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
2024-04-26 02:18:19 -05:00
Jim Salter b31ed6e325
Merge pull request #916 from 0xFelix/zstdmt
syncoid: Add zstdmt compress options
2024-04-22 12:14:40 -04:00
Jim Salter d800e5e17d
Merge pull request #903 from spicyFajitas/regather_snapshots--delete-target-snaps_task
fix(syncoid): regather $snaps on --delete-target-snapshots flag
2024-04-22 12:12:58 -04:00
0xFelix 8b7d29d5a0 syncoid: Add zstdmt compress options
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>
2024-04-20 18:41:43 +02:00
Christoph Klaffl b4c8e4b499
Merge branch 'master' into improve-output 2024-04-18 14:30:04 +02:00
Christoph Klaffl 6c1e31e551
handle error output for filtered replications 2024-04-18 08:22:37 +02:00
Christoph Klaffl eb4fe8a01c
added missing status information about what is done and provide more details 2024-04-18 07:42:47 +02:00
Christoph Klaffl a059054ffb
rename ssh control socket to avoid problem with length limits and conflicts 2024-04-17 08:14:04 +02:00
Adam Fulton d08b2882b7 finish rebase to master 2024-04-01 13:16:16 -05:00
Adam Fulton f89372967f fix(syncoid): regather $snaps on --delete-target-snapshots flag 2024-04-01 13:12:59 -05:00
Nick Liu ab361017e7
feat(syncoid): Match snapshots to bookmarks by `createtxg` if possible
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
2023-04-25 17:07:32 -05:00
Nick Liu 8907e0cb2f
feat(syncoid): Sort snapshots by `createtxg` if possible
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
2023-04-28 00:43:47 -05:00
Nick Liu 8fabaae5b8
feat(syncoid): Add "createtxg" property to `getsnaps`
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).
2023-04-25 14:01:54 -05:00
Nick Liu e301b5b153
refactor(syncoid): Simplify getsnaps to parse a hash rather than lines
* 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.
2023-04-25 13:58:40 -05:00
Jim Salter a5fa5e7bad
Merge pull request #843 from mjeanson/master
Fix typos in syncoid documentation
2024-01-13 21:32:08 -05:00
Christoph Klaffl 790ea544ff
Merge branch 'master' into zfs-get 2024-01-13 23:27:38 +01:00
Christoph Klaffl 0361faac76
Merge branch 'master' into master 2024-01-13 21:56:31 +01:00
Jim Salter 54c2dacd20
Merge pull request #881 from phreaker0/force-delete-skip-root
prevent destroying of root dataset which leads to infinite loop
2024-01-13 15:44:18 -05:00
Jim Salter 4e8b881da7
Merge pull request #882 from phreaker0/preserve-properties-handle-special-symbols
escape property key and value pair in case of property preservation
2024-01-13 15:41:57 -05:00
Christoph Klaffl becddb854f
Merge branch 'master' into preserve-properties-handle-special-symbols 2024-01-13 21:34:45 +01:00
Christoph Klaffl 85e7fca30e
Merge branch 'master' into force-delete-skip-root 2024-01-13 21:29:40 +01:00
Christoph Klaffl ca6e60b920
Merge branch 'master' into update-send-recv-options 2024-01-13 21:22:51 +01:00
Christoph Klaffl 8ce1ea4dc8
fixed refactoring regression 2024-01-13 19:49:20 +01:00
Christoph Klaffl e9eb05e840
Merge branch 'master' into filter-snaps 2024-01-13 19:40:28 +01:00
Christoph Klaffl 6761004939
update possible zfs send options 2024-01-11 21:02:04 +01:00
Christoph Klaffl 4369576ac4
escape property key and value pair in case of property preservation 2024-01-09 20:40:33 +01:00
Christoph Klaffl 48d89c785e
prevent destroying of root dataset which leads to infinite loop because it can't be destroyed 2024-01-09 19:53:03 +01:00
Justin Wolf dbbaac8ac3 modify zfs-get argument order for portability 2023-12-10 21:16:42 -06:00
Jan Krieg 605b7bac1c
fix "creation"/"guid" regex detection 2023-10-29 17:46:28 +01:00
Michael Jeanson 6b874a7e3c Fix typos in syncoid documentation
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
2023-08-03 16:17:51 -04:00
Christoph Klaffl 538416879d
prepare 2.2.0 2023-07-18 18:09:51 +02:00
Christoph Klaffl f3d4d309b5
implemented flag for preserving properties without the zfs -p flag 2023-07-18 08:38:40 +02:00
Christoph Klaffl 1e3874aea5
Merge branch 'master' into direct-connection 2023-04-27 09:16:51 +02:00
Christoph Klaffl 01ace52642
Merge branch 'master' into syncoid-hold 2023-04-26 19:59:20 +02:00
Christoph Klaffl 2143f629d5
Merge remote-tracking branch 'upstream/master' into handle-same-second-bookmarks 2023-04-26 19:40:24 +02:00
Jim Salter e6585e7ee5
Merge pull request #746 from mavhc/master
Removed unneeded 2>/dev/null from mbufferoptions
2023-04-26 13:00:03 -04:00