# ZFS snapshots

Docs: https://github.com/bdrewery/zfstools

```
pkg install zfstools
```

```
zfs set com.sun:auto-snapshot=true zroot/data/syncthing
zfs set snapdir=visible zroot/data/syncthing
```

```
15,30,45 * * * * /usr/local/sbin/zfs-auto-snapshot frequent 4
0 * * * * /usr/local/sbin/zfs-auto-snapshot hourly 24
7 0 * * * /usr/local/sbin/zfs-auto-snapshot daily 14
14 0 * * 7 /usr/local/sbin/zfs-auto-snapshot weekly 12
28 0 1 * * /usr/local/sbin/zfs-auto-snapshot monthly 24
*/20 * * * * /usr/local/sbin/zfs-cleanup-snapshots
```

```
zfs get creation zpool/data/syncthing/shared/jerry/pictures@zfs-auto-snap_hourly-2024-12-21-22h00

NAME                                                                              PROPERTY  VALUE                  SOURCE
zpool/data/syncthing/shared/jerry/pictures@zfs-auto-snap_hourly-2024-12-21-22h00  creation  Sat Dec 21 22:00 2024  -


root@pineapple:/data/syncthing/shared/jerry/pictures/.zfs/snapshot # zfs get -pH -o value creation zpool/data/syncthing/shared/jerry/pictures@zfs-auto-snap_hourly-2024-12-21-22h00
1734814800
```

See:
* https://github.com/j-keck/zfs-snap-diff
* https://j-keck.github.io/zsd/
* https://docs.oracle.com/cd/E19253-01/819-5461/gbcya/index.html