Backbrain   Archive

Zfs Snapshot Size

zfs list -r -t filesystem -o name,used,usedbydataset,usedbychildren,usedbysnapshots,usedbyrefreservation

zfs snapshot sort by size

zfs list -o name,usedbysnapshots | sort -r -k2

example output

root@nas[~]# zfs list -o name,usedbysnapshots | sort -r -k2
NAME                                     USEDSNAP
tank/mailstore                              56.3M
tank/docker/audiobookshelf                   326M
tank/docker/warpgate                         320K
tank/docker/gitea                           26.1M
tank/store                                   261M
tank/docker/lychee                          2.51M
tank/docker                                 2.38M
tank/docker/proxy                           1.96M
tank/root                                    140K
tank/docker/drei                            1.16M
tank/nas/Hoerbuecher/Die-3-Fragezeichen        0B

From the above list, it is then easy to figure out slowtank/backups/restic/restic_data_servers uses the most snapshot space (1.66TB). Snapshots can then be listed for that filesystem by using a command like:

zfs list -t snapshot -r <zfs filesystem>

example 2

zfs list -o name,usedbysnapshots | grep -v " 0B"