Skip to content

Safe way to extend /boot partition on Linux

Reading Time: 4 minutes

The good thing about most of the varieties of Linux OS is that upgrade to the next version is a relatively easy task. Of course, there can be problems with software/drivers compatibility, but in general, these operating systems are designed to support this kind of upgrades. Users of <whatever>buntu that is at least a couple of years old can do a migration to the most recent one. But, the newer the version of the OS – the more resources it requires.

This particular writing is about disk space, and in particular /boot partition. While installing something like Ubuntu 14.04 years ago the installer may suggest a default partitions layout with /boot partition having a size even below a hundred of megabytes. And at that time it was just enough. Then come new versions of OS and software, new kernels, and so on. Upgrades turn to be not that easy anymore. /boot partition is being polluted with old kernels and other leftovers, and needs to be cleaned again and again to complete installation or upgrade.

How to stop this repetitive pain? In case of LVM this could be an easy task but what if it is just a normal filesystem?

Depends on the layout of the partitions it can happen that /boot sits somewhere at the very last physical place on the drive and then it is just a matter of adding extra space to it (if it is available).

But it could be that the layout looks like this:

In this case /boot is the very first partition and moving/resizing of the next ones may be risky.

Disclaimer!

  • Any manipulations with the filesystem may corrupt it, thus be careful and think twice.
  • The current guide is suitable for UEFI boot mode as it is based on partition UUIDs. And in the case of MRB it will not work.

Still, the situation depicted in the image above is not hopeless.

All the operations with the filesystem must NOT be done on the live running system. Instead, a live CD must be used. A good option for this guide is GParted live CD.

Having in mind UEFI feature: partitions lookup is done by UUID, the following steps will allow to extend /boot partition:

  1. Boot with a live CD (e.g. GParted live CD).
  2. Free some space. For the example above a good option could be to cut a bit of /sdb4 from the rear part.
    Note! It is much riskier to cut the front part of the partition or moving it.
  3. With GParted copy /boot partition and paste it to a newly freed place, then resize it to occupy available space.
  4. Now the most important step. As the copy of the partition has the same UUID the old /boot must get a new UUID to avoid UEFI confusion. This can be also done with GParted (right-click on the old /boot partition -> [New UUID] menu item).
  5. Then all the settings must be applied and after reboot the system should use the new extended /boot partition.

New partitions layout will look like this:

If it is not needed then the old /boot partition can be removed.

Done.

 460 total views,  2 views today

Published inLinux

Be First to Comment

Leave a Reply