Boot partition is full

From Klaus' wiki
Jump to: navigation, search

Do the following to keep just the last 2 kernels on your system, to keep /boot clean

As root perform these steps:

Edit /etc/yum.conf and set the following parameter


This will make your package manager keep just the 2 last kernels on your system(including the one that is running)

Centos 7

Then install yum-utils:

]$ yum install yum-utils

Finally make an oldkernel cleanup:

]$ package-cleanup --oldkernels --count=2

Centos 8 and newer Fedora's

    1. dnf repoquery set negative --latest-limit ##
    2. as how many old kernels you want keep ##
]$ dnf remove $(dnf repoquery --installonly --latest-limit=-2 -q)

Check your disk space

Done. This will erase in a good fashion the old kernels, and, keep just the last 2 of them for the next upgrades.

You can check the space left on the partition by issuing:

]$ df -h

expect something like

Filesystem                Size  Used Avail Use% Mounted on
/dev/mapper/cl_jdoe-root   13G  8.0G  5.1G  62% /
devtmpfs                  2.0G     0  2.0G   0% /dev
tmpfs                     2.0G   96K  2.0G   1% /dev/shm
tmpfs                     2.0G  8.7M  2.0G   1% /run
tmpfs                     2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs                     2.0G   40K  2.0G   1% /tmp
/dev/sda1                 497M  276M  222M  56% /boot
tmpfs                     396M  4.0K  396M   1% /run/user/42
tmpfs                     396M   48K  396M   1% /run/user/1001

Source for inspiration: StackExchange