ZFS snapshots
If you're like me and you're running a long lived FreeBSD server, and it uses ZFS but you don't really need or use the ZFS features and are frankly confused by it and prefer the old ffs
days and you're wondering where all your disk space has gone since zpool
says one thing but df
says another...
You probably have a bunch of snapshots of older versions of FreeBSD put there by freebsd-update
taking up space you could reclaim.
zfs list -t snapshot
will give you an idea and zfs destroy
will let you delete the old ones.
Here's what zfs list -t snapshot
shows my on my system now:
: zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT
zroot/ROOT/default@2023-12-04-12:35:05-0 9.23M - 5.06G -
zroot/ROOT/default@2023-12-04-12:37:05-0 2.72M - 5.16G -
zroot/ROOT/default@2023-12-04-12:45:33-0 8.05M - 5.12G -
zroot/ROOT/default@2023-12-07-09:58:45-0 222M - 5.58G -
This is after I've cleaned it up and I can't really bring back what I reclaimed. But in the USED
column I had some old snapshots using gigabytes of data.
Here's the partial output of zfs list
for every dataset:
: zfs list
NAME USED AVAIL REFER MOUNTPOINT
zroot 8.50G 8.45G 88K /zroot
zroot/ROOT 7.61G 8.45G 88K none
zroot/ROOT/13.2-RELEASE-p5_2023-12-04_123505 8K 8.45G 5.06G /
zroot/ROOT/14.0-RELEASE-p1_2023-12-04_124533 8K 8.45G 5.12G /
zroot/ROOT/14.0-RELEASE-p1_2023-12-07_095845 8K 8.45G 5.58G /
zroot/ROOT/14.0-RELEASE_2023-12-04_123705 8K 8.45G 5.16G /
zroot/ROOT/default 7.61G 8.45G 5.55G /
Notice how there's some marked with the FreeBSD release? freebsd-update
will make those snapshots before upgrading the system and if you don't remove them they'll stay there forever.
I recovered about 10GB by removing very old snapshots, on my 20GB VPS this was very handy.