Kategorien
Allgemein

ZFS: How to get the size used by a number of snapshots or a whole destination

If you setup your ZFS on your UNIX system sth similar like I did, at some point, you might want to figure out what the hell is taking up all that space in snapshots either internally or externally. A good idea is then to first go through zfs list and get an idea of where culprits *may* lie.

If you use znapzend, then to get a good overview, znapzend ships with znapzendztatz which can help you as well.

And if you honed it down to a specific dataset and you just shuffled around large amounts of data and want to get rid of some snapshots to reclaim space, you can figure out how much space you would actually reclaim by deleting snapshots with first getting a list of available snapshots:

zfs list -t snapshot -d 1 $pool/dataset/you/want/info/about

and then trying some ranges:

zfs destroy -n -v pool/temp@2015-09-10-140000%2015-09-12-030000

the option -n is the critical part as it does a dry run, which means it doesn’t delete anything just yet.

If you’re fine with the range you found and are sure you’re not deleting the last common snapshot between src and dst in the manner, go ahead, run the same command without the -n and it should delete them and give you your space back. 🙂