ZFS bpool is almost full; how can I free up space so I can keep updating my system without errors?
Uninstalling old and unused kernels and associated files is the correct action to take; to avoid the suggestion to install an unsigned kernel, remove packages that depend on linux-image-5.11.0-34-generic
via:
sudo apt purge linux*5.11.0-34*
The second step required to free up space is to remove old snapshots referencing the files that were removed; list the snapshots via:
zfs list -r -t snapshot -o name,used,referenced,creation bpool/BOOT
You can see in the REFER
column how much data is referenced. Identical numbers often coincide with minimal USED
values; the snapshots are effectively copies of previous snapshots.
Manually remove the five oldest snapshots via:
zfs list -r -t snapshot -o name,used,referenced,creation bpool/BOOT | head -n 5 | cut -c 35-40 | xargs -n 1 zsysctl state remove --system
Keep removing snapshots until you see space being freed up.
(Source of the last one-liner and more info: https://github.com/ubuntu/zsys/issues/155)
Notes:
-
Growing a ZFS pool is possible if there is unallocated space, but Ubuntu allocates the remaining space to
rpool
. Shrinking a ZFS pool in-place is apparently not possible. -
I see auto-snapshotting is turned on for
bpool
, but unless you expect any files to change outside of APT, ZSys snapshotting should be sufficient and would reduce the number of snapshots you have to consider. -
To avoid this problem in the future, stay on top of kernel upgrades and remove old ones regularly. Also consider reducing the ZSys garbage cleaning defaults in
/etc/zsys.conf
. For an example, see: https://github.com/ubuntu/zsys/issues/155#issuecomment-758902487