Table of Contents
OpenBSD — How upgrade with limited free space on /usr
On small systems, or on VMs with small virtual boot disks, the automatic partitioning will sometimes lead to a /usr partition that is too limited in size. During normal operations this will probably not hurt anything but sysupgrade(8) may complain that there is not enough free space on /usr.
Possible solutions
-
One way to solve this would be to increase the partition size. But alas OpenBSD is unable to do this without a lot of manual work and potential issues.
-
Another way would be to recreate the machine with a bigger disk. That may be feasible in a VM but on real hardware it could lead to additional problems. Also setting up a new system and transferring all of the data and settings is tedious at best. Long term it is probably the right solution though.
-
A third way would be to somehow free up space on
/usr. This is the option we will look at in more detail.
Freeing up space on /usr
/usr/share/relink
It so happens that /usr/share/relink has a significant size and its contents is not directly needed for the upgrade or during normal operations. In fact its contents will be recreated during the upgrade. On OpenBSD 7.8-current, arm64 with multiple CPU cores, the size is 430 MB on one of my machines (with a 2.3 GB /usr partition, so more than 18% of the space). 398 MB of which are in /usr/share/relink/kernel.
Removing those files using # rm -rf /usr/share/relink/kernel followed by # sysupgrade, or # sysupgrade -s as the case may be, will often work. In fact it recently allowed me to upgrade one of my VMs, when the free space on /usr was only 1,019 MB before — too low for sysupgrade(8).
sysclean
The port sysclean may help to free up a bit of space on some systems. sysclean does not delete anything by itself. It just lists files that it deems obsolete. So read the man page and check its output before using something like:
# rm $(sysclean|egrep '^/usr')
The amount of free space gained by this is moderate in most cases though. But every bit helps.