Merging the boot partition

Christopher Dakin

Upgrading Linux Kernels with small boot partition

With recent linux kernel upgrades to the underlying OS you may find that when running upgrade checks that the system is prompting you more often to install these kernel upgrades more often.

This may also stop OS upgrades for the same reason.

Older LogonBox VMs had a separate /boot partition with a relatively small size. This partition is now too small to take these new kernels.

We can work around this by just merging the boot partition into the root partition as there is no specific need for boot to be on its own partition any more.

 

Merging /boot partition into root

First, back up or snapshot your system, just in case the merge fails and you need to revert the changes. Although this method has worked in every case we have tested it in.

 

First, check what hard disk device name is in use by running df. On most VMs, this should be /dev/sda but on cloud based VMs or if you used the ISO to install, this device name may differ.

Note: If you used the ISO to create an encrypted root partition, it would be advisable to keep a separate boot partition.

 

See this example of the df output. /boot is running on /dev/sda1, so our hard disk device will be /dev/sda (needed later in the instructions).

We can also see the fstab entry that will need editing below.

 

Now run the following commands from a shell to merge the boot partition:

mkdir /boot2
cp -a /boot/* /boot2/
umount /boot
rmdir /boot
mv /boot2 /boot

Edit /etc/fstab and delete the line that defines the mount point for /boot (I use vi for this). The UUID will differ, but it's the only line with /boot in it.
i.e UUID=b574b096-b325-4db0-be9c-52838b00bfaa /boot ext2 defaults 1 2
Save the file

 

Complete the merge with the following commands:

grub-install /dev/sda (making sure you have the correct disk device name here as mentioned earlier)
update-grub
reboot

After the reboot, you can see that there is no longer a boot partition, the directory is now part of the root: