-
Notifications
You must be signed in to change notification settings - Fork 27
Command zfs(something)
Commands for zfs snapshots (FreeBSD, not tested on Linux)
zpaqfranz -h zfs
- zfslist => show some snapshots
- zfspurge => create a script with zfs destroy (with -output something.sh)
- zfsadd => freeze snapshot into zpaq archive
Show all the snapshots
zpaqfranz zfslist "*"
Show all the snapshots that END with "--5d"
zpaqfranz zfslist "*" "--5d"
Show snapshots that START with "zroot/ssd@2021" and END with "--5d"
zpaqfranz zfslist "zroot/ssd@2021" "--5d"
Redirect output to pippo.sh
zpaqfranz zfslist "zroot/ssd@2021" "--5d" -output pippo.sh
Prepare a script for mass-destruction of snapshots Work just as zfslist, only one example on pippo.sh
zpaqfranz zfspurge "zroot/ssd@2021" "--5d" -output pippo.sh
Prepare a script for multiple add(), or freeze some snapshots into an archive
NOTE: assume that "into" the snapshot name is "merged" the timestamp, as crontab script do.
headertimestampfooter
- tank/d@2021-08-12_09.00.00--7d is good
- tank/pippo@quickdelete is not
In this example we have 3 snapshots (made for example by zfSnap or whatever)
We filter the "header" (the first part, the day) and the "footer" (the last, the "--7d")
root@aserver:/tmp/47 # ./zpaqfranz zfslist "tank/d@2021-08-12" "--7d"
zpaqfranz v52.16-experimental snapshot archiver, compiled Aug 12 2021
tank/d@2021-08-12_09.00.00--7d
tank/d@2021-08-12_11.00.00--7d
tank/d@2021-08-12_13.00.00--7d
OK now we take ALL the 3 snapshots (or 3.000) into a single file, with
zpaqfranz zfsadd "tank/d@2021-08-12" "--7d" "/temporaneo/daprog2.zpaq" "scanner" -force
Please note "scanner" is an optional subfolder (just an example, if omitted get all the snapshot)
-force to make a wet run (direct).
Now we get the 3 snapshots into the archive, with minimum space needed, marked @ the timestamps (do you want back the snapshot @11:00:00, yes you can)
root@aserver:/tmp/47 # ./zpaqfranz i /temporaneo/daprog2.zpaq
zpaqfranz v52.16-experimental snapshot archiver, compiled Aug 12 2021
/temporaneo/daprog2.zpaq:
3 versions, 3.503 files, 36.805 fragments, 2.079.947.186 bytes (1.94 GB)
Version(s) enumerator
-------------------------------------------------------------------------
< Ver > < date > < time > < added > <removed> < bytes added >
-------------------------------------------------------------------------
00000001 2021-08-12 09:00:00 +00003500 -00000000 -> 2.079.563.812
00000002 2021-08-12 11:00:00 +00000002 -00000001 -> 382.735
00000003 2021-08-12 13:00:00 +00000001 -00000002 -> 639
It is now safe to prune the oldest snapshots (typically by crontab)