jimsalterjrs / sanoid

These are policy-driven snapshot management and replication tools which use OpenZFS for underlying next-gen storage. (Btrfs support plans are shelved unless and until btrfs becomes reliable.)
http://www.openoid.net/products/
GNU General Public License v3.0
3.14k stars 308 forks source link

Sanoid/syncoid integration #936

Closed araemo closed 4 months ago

araemo commented 4 months ago

I am using sanoid and syncoid to do a daily snapshot of a space-constrained all-NVME pool, and replicate the snapshots to a bulk storage pool. It works well, but I'd like to see a bit of integration between the two.

Currently, I keep 2 days of snapshots on the source pool, and replicate (using existing snapshots only, no sync snap) the snapshots to the bulk pool.

If for some reason, the sync fails, there's nothing stopping sanoid from deleting the older snapshot, and that could get me into a state where I no longer have any snapshots that match on both sides.

I could probably 'fix' this by using a sync snapshot, but I am very space constrained on the source, so I'd rather avoid this if possible.

What I'd like to see is one of two things:

  1. A way to trigger a syncoid transfer immediately after a sanoid snapshot (I tried using the post-snapshot hook, but it looks like it timed out because the sync took too long)
  2. A way to check a remote for snapshots before deleting them from the dataset (this would be preferred, honestly)
    1. For example, define a "remote" target (Mine is actually on the same host, but it would be best to make this agnostic) in the sanoid config, and require snapshots exist on the remote before deleting them from the targeted pool
phreaker0 commented 4 months ago

If you are space constrained you can use zfs bookmarks, in this case you can still replicate from your source pool even if the snapshot on the source is destroyed (but a corresponding zfs bookmark exists).

Regarding your other points:

  1. you can increase or disable the default timeout (https://github.com/jimsalterjrs/sanoid/blob/a7e6c2db680a76784448ba1f810d7df9a50c3ddc/sanoid.defaults.conf#L27)
  2. you can do this with the 'pre_pruning_script' hook in sanoid