zfs snapshot sort by size

When you see your zpool exploding, but the “used” size isn’t that much, you may take a look at your snaphosts.

First find the dataset with the that has the largest snapshot

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

example output

tank/mails                                  56.3G
tank/store                                   261M
tank/docker                                 2.38M

In this case the tank/mails dataset should be looked at.

Snapshots can then be listed for that filesystem by using a command

# zfs list -t snapshot -r 
zfs list -t snapshot -r tank/mails 

Leave a Reply

Your email address will not be published. Required fields are marked *