Ubuntu03 Oct 2017 12:43 pm

I’ve recently been looking at issues regarding separate /boot partitions and people running out of free space. Being a long time user of Ubuntu and LVM, I have a /boot partition that was appropriately sized for kernel of the release I installed (Ubuntu 13.04!), but now that I’m running Artful Aardvark, which will become Ubuntu 17.10, my /boot partition is a bit small.

I don’t have any extraneous files in my /boot partition, like .old-dkms files (being worked in bug 1515513) or old kernels. So I need some solution to make the files that are there take up less space. Fortunately, it is possible to choose the compression method used by update-initramfs when it makes initrd images. The default “COMPRESS=gzip” can be found in /etc/initramfs-tools/initramfs.conf.

Because configuration options are also read from /etc/initramfs-tools/conf.d/ and after the initial initramfs.conf file I decided to create a file named “compressed” in that directory with the contents:

COMPRESS=xz

After which I needed to update the initrd.img files in my /boot partition. I can do this with:

sudo update-initramfs -u -k all

Its easy to confirm the compression method used:

$ file /boot/initrd.img-4.12.0-13-generic
/boot/initrd.img-4.12.0-13-generic: XZ compressed data

Now I’ve managed to create some more free space in my /boot partition, however it may take a bit longer for update-initramfs to run and may increase boot time a little. That sounds better than reinstalling though!

2 Responses to “Creating more free space in /boot”

  1. on 05 Oct 2017 at 8:28 am Robert Jennings

    If you have a system with limited RAM (i.e. a small cloud instance with 256MB RAM) you might need to limit xz’s memory usage to prevent the kernel OOM (out of memory) killer from killing processes.

    To limit memory usage, place the following in the same file as the “COMPRESS=xz” directive:

    XZ_OPT=–memlimit-compress=5%


  2. […] http://www.murraytwins.com/blog/?p=156 […]

Trackback this Post | Feed on comments to this Post

Leave a Reply