How To Fix A Full /boot Partition on Linux

How To Fix A Full /boot Partition on Linux

Get Social!

full-boot-mountUtilities such as apt-get generally install kernel updates by adding the new kernel to the Linux boot list and set it as the default. This means that the next time the system boots, the new kernel will be loaded. The problem is that the old kernel is still there (just incase the new one doesn’t work, you’ve got a fall back!), and the kernel before that, and the kernel before that…

The current 3.x kernel for Ubuntu is around 20MB so it doesn’t take long for the kernel updates to fill a tiny 200-or-so-Mb boot partition where they are stored.

The good news is that it’s easy to clear out the old updates, but it’s important to not remove the latest one that you’re using.

Which Kernel am I Running?

It’s quick and easy to see which kernel version you are running. Use the uname command with the -a switch and pay attention to the version numbers reported.

uname -a
3.19.0-47-generic

This shows that you’re using version 3.19.0-47.

List Currently Installed Kernels

Next you’ll need to list the kernel packages that are currently installed so that you can remove any outdated ones to free up the space on the /boot partition.

Run the below dpkg command to list the installed kernel packages and their versions.

dpkg --list 'linux-image*'

dpkg-kernel-package-listThe above output shows several versions of kernel that are all taking up space on the /boot partition however we only really need the current running version given by the above uname -a command. It’s a good idea to keep the last 2 kernels just incase you notice an issue down the line, but the above list is quite excessive.

Remove Unused Kernel Packages to Free Space on /boot

Once you’ve identified your current kernel and the kernel packages you have installed it’s time to remove the ones you don’t need.

Using apt-get enter the package names of the kernel packages to remove.

apt-get remove linux-image-3.19.0-25-generic

If you get an error running this command then see the next section.

note: the above screenshot of the installed packages cropped the full version name – it’s missing the generic part. You can use tab completion with the apt-get command, or use an asterisk after the version number to remove the required package. 

Errors Removing Packages

If you get an error warning about dependencies similar to the below then you may need to manually remove a few kernel packages to free up some space.

[root@server:~] $apt-get remove linux-image-extra-3.19.0-25-generic
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies.
 linux-image-generic-lts-vivid : Depends: linux-image-3.19.0-49-generic but it is not going to be installed
                                 Depends: linux-image-extra-3.19.0-49-generic but it is not going to be installed
                                 Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

The problem here is that the original update failed to install the latest version of the kernel (version 3.19.0-49-generic in this case) and apt-get doesn’t like doing anything else until that problem has been resolved.

First we need to free up some space. Carefully delete 2 of the older kernel packages with a command similar to the below, but with old version numbers from your system returned by the above section List Currently Installed Kernels.

rm /boot/*-3.19.0-25*
rm /boot/*-3.19.0-33*

Check and double check this command because there’s no going back once it’s ran! It’s perfectly safe to do as long as you are using old version numbers that you’re no longer using.

You can now run apt-get to complete the original upgrade now that it has the space. This will remove the error when trying to remove the unused kernel packages in the above section.

apt-get install -f

Now go back to the above section and remove the old kernel packages that you no longer need.


Proxmox advanced install settings

Get Social!

proxmox logo gradInstalling Proxmox is quick and easy – the installer GUI takes care of everything, such as installing the correct packages and partitioning the root hard disk.

You can download Proxmox from the Proxmox download page as an ISO which you will need to boot your server from.

See my  Install guide blog post for the basics on installing Proxmox.

On more advanced installs, there may be a need to override some of these options. For example, you may want to specify how much swap space is created, or the size of the root partition. On one of my installs using a 120GB disk as the install device, 28GB is used for my root (/) partition on a default install. As I only run the basic, required packages on the host this size is far too large. With larger disks the problem gets worse.

When installing proxmox, the first screen of the installer is the Boot menu. At this prompt, we can specify arguments to override the defaults.

Proxmox boot install screen

The above example linux ext4 maxroot=10 swapsize=20 sets the partition format to ext4 (ext3 is the default), creates a root partition of 10GB providing the disk is large enough and swapsize of 20GB.

The options available at the boot menu are:

  • linux ext4 – sets the partition format to ext4. The default is ext3.
  • hdsize=nGB – this sets the total amount of hard disk to use for the Proxmox installation. This should be smaller than your disk size.
  • maxroot=nGB – sets the maximum size to use for the root partition. This is the max size so if the disk is too small, the partition may be smaller than this.
  • swapsize=nGB – sets the swap partition size in gigabytes.
  • maxvz-nGB – sets the maximum size in gigabytes that the data partition will be. Again, this is similar to maxroot and the final partition size may be smaller.
  • minfree=nGB – sets the amount of free space to remain on the disk after the Proxmox instillation.

Visit our advertisers

Quick Poll

Are you using Docker.io?

Visit our advertisers