Difference between revisions of "Boot partition is full"
From Klaus' wiki
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Do the following to keep just the last 2 kernels on your system, to keep /boot clean | 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 | Edit /etc/yum.conf and set the following parameter | ||
Line 7: | Line 9: | ||
This will make your package manager keep just the 2 last kernels on your system(including the one that is running) | 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: | Then install yum-utils: | ||
Line 19: | Line 22: | ||
</source> | </source> | ||
+ | ===Centos 8 and newer Fedora's=== | ||
+ | ## dnf repoquery set negative --latest-limit ## | ||
+ | ## as how many old kernels you want keep ## | ||
+ | <source lang=bash> | ||
+ | ]$ dnf remove $(dnf repoquery --installonly --latest-limit=-2 -q) | ||
+ | </source> | ||
+ | ==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. | Done. This will erase in a good fashion the old kernels, and, keep just the last 2 of them for the next upgrades. | ||
Line 38: | Line 48: | ||
tmpfs 396M 4.0K 396M 1% /run/user/42 | tmpfs 396M 4.0K 396M 1% /run/user/42 | ||
tmpfs 396M 48K 396M 1% /run/user/1001 | tmpfs 396M 48K 396M 1% /run/user/1001 | ||
+ | |||
+ | |||
+ | Source for inspiration: [http://unix.stackexchange.com/questions/105026/boot-partition-is-almost-full-in-centos#105029 StackExchange] |
Latest revision as of 12:52, 5 November 2020
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
installonly_limit=2
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
- dnf repoquery set negative --latest-limit ##
- 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