I want to archive the snapshots just before delete it.
In this example 2-hours snapshot are created, and retained for 7d (seven days).
After that the older (>7) will be deleted, it is a well known, widespread mechanism
Code:
/tank/d@2021-07-26_09.00.00--7d
/tank/d@2021-07-26_11.00.00--7d
/tank/d@2021-07-26_13.00.00--7d
/tank/d@2021-07-26_15.00.00--7d
/tank/d@2021-07-26_17.00.00--7d
/tank/d@2021-07-26_19.00.00--7d
/tank/d@2021-07-27_09.00.00--7d
/tank/d@2021-07-27_11.00.00--7d
/tank/d@2021-07-27_13.00.00--7d
/tank/d@2021-07-27_15.00.00--7d
/tank/d@2021-07-27_17.00.00--7d
/tank/d@2021-07-27_19.00.00--7d
/tank/d@2021-07-28_09.00.00--7d
/tank/d@2021-07-28_11.00.00--7d
/tank/d@2021-07-28_13.00.00--7d
/tank/d@2021-07-28_15.00.00--7d
/tank/d@2021-07-28_17.00.00--7d
/tank/d@2021-07-28_19.00.00--7d
/tank/d@2021-07-29_09.00.00--7d
/tank/d@2021-07-29_11.00.00--7d
/tank/d@2021-07-29_13.00.00--7d
/tank/d@2021-07-29_15.00.00--7d
/tank/d@2021-07-29_17.00.00--7d
/tank/d@2021-07-29_19.00.00--7d
/tank/d@2021-07-30_09.00.00--7d
/tank/d@2021-07-30_11.00.00--7d
/tank/d@2021-07-30_13.00.00--7d
/tank/d@2021-07-30_15.00.00--7d
/tank/d@2021-07-30_17.00.00--7d
/tank/d@2021-07-30_19.00.00--7d
/tank/d@2021-07-31_09.00.00--7d
/tank/d@2021-07-31_11.00.00--7d
/tank/d@2021-07-31_13.00.00--7d
/tank/d@2021-07-31_15.00.00--7d
/tank/d@2021-07-31_17.00.00--7d
/tank/d@2021-07-31_19.00.00--7d
/tank/d@2021-08-01_09.00.00--7d
/tank/d@2021-08-01_11.00.00--7d
/tank/d@2021-08-01_13.00.00--7d
/tank/d@2021-08-01_15.00.00--7d
/tank/d@2021-08-01_17.00.00--7d
/tank/d@2021-08-01_19.00.00--7d
/tank/d@2021-08-02_09.00.00--7d
/tank/d@2021-08-02_11.00.00--7d
/tank/d@2021-08-02_13.00.00--7d
Tomorrow those snapshots will be erased
Code:
/tank/d@2021-07-26_09.00.00--7d
/tank/d@2021-07-26_11.00.00--7d
/tank/d@2021-07-26_13.00.00--7d
/tank/d@2021-07-26_15.00.00--7d
/tank/d@2021-07-26_17.00.00--7d
/tank/d@2021-07-26_19.00.00--7d
With my little software I can archive all the data in those snapshot.
So, tomorrow, after the crontabbe-prune runs, the deleted snapshot will be (forever) in my archive.
If in 2022 I want to get back data @2021-07-26_17.00.00 I can, even if the snapshot is deleted long time before.
However, I have a technical limitation: the snapshots must be monotonous and growing.
If I archive the snapshots of July 26th, 27th, 28th (in that order) there is no problem. And after that 29, 30, 1 aug ..., that's OK (monotono crescente).
Instead, I CANNOT do it in the sequence (let's say) July 26, 28, 27.
Why? Trust me (it is long to explain).
Perhaps, however, there are software already made that can store entire snapshots (possibly hundreds of GB each), in an arbitrary sequence (26, 28, 27)
Just to be clear it is not realistic to use something like rar (or tar, or 7z, or lzturbo, or zstd or whatever)
Code:
rar a /myfreezedsnapshot.rar /tank/d/.zfs/snapshot/2021-07-26_09.00.00--7d /tank/d/.zfs/snapshot/2021-07-26_11.00.00--7d /tank/d/.zfs/snapshot/2021-07-26_13.00.00--7d /tank/d/.zfs/snapshot/2021-07-26_15.00.00--7d /tank/d/.zfs/snapshot/2021-07-26_17.00.00--7d /tank/d/.zfs/snapshot/2021-07-26_19.00.00--7d
A zfs send automation script (to turn snapshots into files via redirection) will be fine,
BUT (AFAIK) would not allow to restore a single file from a snapshot without restoring "the whole world".
In other words: in 2022 (for example) I want to get back /tank/d/.zfs/snapshot/2021-07-26_11.00.00/usr/local/etc/smb4.conf