ounce (codename: "dimebag") is a wrapper script for httm which gives you no mental overhead, non-periodic dynamic snapshots.
When I type ounce nano /etc/samba/smb.conf (I actually alias $EDITOR='ounce --trace $EDITOR'), ounce knows that it's smart and I'm dumb, and it sees that I just edited /etc/samba/smb.conf a few short minutes ago, because ounce uses seccomp and eBPF to trace all the file open calls my $EDITOR makes, and ounce uses httm to check whether I have any un-snapshot-ed file changes. If I do, it takes a snapshot before I write to that file again.
Instead of an auto-save, you now have an auto-snapshot. Of course, we can confirm the snapshot was taken with httm:
➜ httm /etc/samba/smb.conf ───────────────────────────────────────────────────────────────────────────────────── Tue Aug 09 16:46:14 2022 17.6 KiB "/.zfs/snapshot/autosnap_2022-10-19_20:00:22_hourly/etc/samba/smb.conf" Fri Oct 21 09:11:17 2022 17.6 KiB "/.zfs/snapshot/snap_2022-10-21-09:11:18_ounceSnapFileMount/etc/samba/smb.conf" ───────────────────────────────────────────────────────────────────────────────────── Fri Oct 21 09:11:25 2022 17.6 KiB "/etc/samba/smb.conf" ─────────────────────────────────────────────────────────────────────────────────────
Of course, snapshotting changes before you edit files is not all ounce is good for. You can also use it to guard removal or renaming actions (and you can alias rm="ounce rm"):
➜ touch ~/dummyfile; ounce rm ~/dummyfile; httm ~/dummyfile ───────────────────────────────────────────────────────────────────────────────────── Wed Feb 15 12:59:42 2023 0 bytes "/home/kimono/.zfs/snapshot/snap_2023-02-15-12:59:42_ounceSnapFileMount/dummyfile" ───────────────────────────────────────────────────────────────────────────────────── "/home/kimono/dummyfile" ─────────────────────────────────────────────────────────────────────────────────────
ounce is just one example of a new use enabled by your snapshot data at your finger tips. Discover more at httm.
[link] [comments]