ZFS boot pool
Tue, Dec 5, 2023 · 2 minute readlinux
The following applies to Ubuntu 22.04.3.
It may work for other versions, YMMV.
Use at your own risk.
I like ZFS, a lot.
It’s my preferred filesystem for most things, in particular Linux Containers (lxc).
I’ve been running one server with a boot pool using ZFS.
When configured this way a service (zsys) runs which should tidy up old kernels and snapshots to release space.
The default settings for zsys (in /etc/zsys.conf) are usually OK, until you run a desktop and/or do frequent apt updates.
Then you will probably start to see errors like this:
ERROR couldn't save system state: Minimum free space to take a snapshot and preserve ZFS performance is 20%.
Free space on pool "bpool" is 17%.
These operations save system state by taking a ZFS snapshot.
The way I free up space is to manually delete these snapshots as follows:
List current free space in bpool
# zpool list bpool NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT bpool 1.88G 1.56G 322M - - 43% 83% 1.00x ONLINE -
List snapshots in bpool
The REFER column tells us that these two snapshots are referencing 1510M disk space.
# zfs list -r -t snapshot -o name,used,referenced,creation bpool/BOOT
NAME USED REFER CREATION
bpool/BOOT/ubuntu_cchcgi@autozsys_0ybgy0 88K 755M Mon Nov 13 7:54 2023
bpool/BOOT/ubuntu_cchcgi@autozsys_8x0r84 88K 755M Wed Nov 29 8:02 2023
Remove snapshots
# zsysctl state remove 0ybgy0 --system ZSys is adding automatic system snapshot to GRUB menu # zsysctl state remove 8x0r84 --system ZSys is adding automatic system snapshot to GRUB menu
Wait a few minutes
… and disk space should be freed.
# zpool list bpool
NAME SIZE ALLOC FREE CKPOINT EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
bpool 1.88G 909M 1011M - - 20% 47% 1.00x ONLINE -
Hope this helps someone.