{"id":5980,"date":"2020-12-12T11:00:07","date_gmt":"2020-12-12T05:30:07","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=5980"},"modified":"2026-11-21T12:06:12","modified_gmt":"2026-11-21T06:36:12","slug":"how-to-solve-boot-partition-full-issue-in-centos","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-solve-boot-partition-full-issue-in-centos\/","title":{"rendered":"How to solve boot partition full issue in CentOS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Post Date:<\/strong> December 12, 2020<br><strong>Last Updated:<\/strong> November 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to fix the <strong>boot partition full issue<\/strong> in CentOS by removing old kernels the safe way. Every kernel update adds a new set of files to the <code>\/boot<\/code> partition. CentOS keeps several older kernels by default, so a small <code>\/boot<\/code> fills up after a few updates and later updates fail with &#8220;No space left on device&#8221;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The original guide gave the right idea: limit the kernels with <code>installonly_limit<\/code> and clean up with <code>package-cleanup<\/code>. This version adds a disk check, a safe way to confirm the running kernel, the commands for CentOS 8 and later, a manual rescue for when <code>yum<\/code> itself fails, and troubleshooting.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Warning:<\/strong> When you fix the boot partition full issue, never delete files from <code>\/boot<\/code> by hand with <code>rm<\/code>. The files belong to installed kernel packages, and deleting them can leave the server unable to boot. Always remove kernels with <code>yum<\/code>, <code>dnf<\/code> or <code>rpm<\/code>, and keep the kernel you are running now.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you fix the boot partition full issue, make sure you have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Root or sudo access to the server over SSH<\/li>\n\n\n\n<li>The output of <code>df -h \/boot<\/code>, so you know how full the partition is<\/li>\n\n\n\n<li>Console or out-of-band access if this is a production server, in case a reboot is needed<\/li>\n\n\n\n<li>A snapshot or backup of the server, if possible<\/li>\n\n\n\n<li>Knowledge of your package manager (<code>yum<\/code> on CentOS 7, <code>dnf<\/code> on CentOS 8 and later)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Each kernel update installs a new <code>vmlinuz<\/code>, <code>initramfs<\/code>, <code>System.map<\/code> and <code>config<\/code> set into <code>\/boot<\/code><\/li>\n\n\n\n<li>The <code>installonly_limit<\/code> setting in <code>\/etc\/yum.conf<\/code> decides how many kernel versions the package manager keeps<\/li>\n\n\n\n<li>The CentOS 7 default is 5, and <code>\/boot<\/code> partitions of 500 MB or less often cannot hold that many<\/li>\n\n\n\n<li><code>package-cleanup --oldkernels<\/code> removes kernel packages beyond the number you set, newest ones are kept<\/li>\n\n\n\n<li>Removing a kernel package also deletes its files from <code>\/boot<\/code> and updates the GRUB menu<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The image below shows the workflow. For the official references, see the <a href=\"https:\/\/man7.org\/linux\/man-pages\/man5\/yum.conf.5.html\" target=\"_blank\" rel=\"noopener\">yum.conf manual<\/a> and the DNF documentation on <a href=\"https:\/\/dnf.readthedocs.io\/en\/latest\/conf_ref.html\" target=\"_blank\" rel=\"noopener\">configuration options<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/CentOS-Boot-Partition-Cleanup.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/CentOS-Boot-Partition-Cleanup-1024x576.png\" alt=\"\" class=\"wp-image-13754\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/CentOS-Boot-Partition-Cleanup-1024x576.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/CentOS-Boot-Partition-Cleanup-300x169.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/CentOS-Boot-Partition-Cleanup-768x432.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/CentOS-Boot-Partition-Cleanup-1536x864.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/CentOS-Boot-Partition-Cleanup.png 1672w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Fix the Boot Partition Full Issue in CentOS<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Check the Disk and the Running Kernel<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Log in to the server over SSH and look at <code>\/boot<\/code> and the kernels installed:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df -h \/boot\nuname -r\nrpm -q kernel --last\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>uname -r<\/code> prints the kernel you are running now, and the original guide used <code>uname -a<\/code>, which prints more than you need. <code>rpm -q kernel --last<\/code> lists installed kernels with the newest first. Make sure the running kernel is one of the first two. If it is an older one, reboot into the newest kernel before you clean up.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Limit the Number of Kernels Kept<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Back up the file, then set the limit:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo cp \/etc\/yum.conf \/etc\/yum.conf.bak\nsudo nano \/etc\/yum.conf\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the <code>[main]<\/code> section, add or change this line:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">installonly_limit=2\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This setting stops the boot partition full issue from coming back, because later updates remove the oldest kernel automatically. Two is the smallest value yum accepts. It keeps the current kernel and one fallback.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/Screen-Shot-2020-12-12-at-10.40.13-AM-1024x713-1.png\"><img decoding=\"async\" width=\"1024\" height=\"713\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/Screen-Shot-2020-12-12-at-10.40.13-AM-1024x713-1.png\" alt=\"\" class=\"wp-image-13753\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/Screen-Shot-2020-12-12-at-10.40.13-AM-1024x713-1.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/Screen-Shot-2020-12-12-at-10.40.13-AM-1024x713-1-300x209.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/Screen-Shot-2020-12-12-at-10.40.13-AM-1024x713-1-768x535.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">3. Install yum-utils<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>package-cleanup<\/code> command comes from this package:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo yum install yum-utils\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Remove Old Kernels to Clear the Boot Partition Full Issue<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the cleanup and keep the two newest kernels:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo package-cleanup --oldkernels --count=2\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The command lists the packages it will remove and asks for confirmation. Check that the running kernel from Step 1 is not in the list, then type <code>y<\/code>. To skip the prompt in a script, add <code>-y<\/code>.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> For CentOS 8, Stream, AlmaLinux and Rocky Linux, use <code>dnf<\/code> instead. Set <code>installonly_limit=2<\/code> in <code>\/etc\/dnf\/dnf.conf<\/code>, then run <code>sudo dnf remove --oldinstallonly --setopt installonly_limit=2 kernel<\/code>.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">5. Verify the Result<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">df -h \/boot\nrpm -q kernel\nsudo grubby --default-kernel\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>\/boot<\/code> should now show free space, only two kernels should remain, and the default kernel should be the newest one. If possible, reboot once in a maintenance window to confirm the server starts normally.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If the boot partition full issue continues, check these:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>&#8220;At least 25MB more space needed on the \/boot filesystem.&#8221;:<\/strong> <code>yum<\/code> cannot install the new kernel because <code>\/boot<\/code> is full. Free space first by removing the oldest kernel package with <code>rpm<\/code>, as shown in the next bullet, then run <code>yum update<\/code> again<\/li>\n\n\n\n<li><strong><code>yum<\/code> cannot run because <code>\/boot<\/code> is full:<\/strong> List the kernels with <code>rpm -q kernel --last<\/code>, pick the oldest one that is not the running kernel, and remove it with <code>sudo rpm -e kernel-3.10.0-1160.el7.x86_64<\/code> (use your own version string). Never remove the running kernel<\/li>\n\n\n\n<li><strong>&#8220;package-cleanup: command not found&#8221;:<\/strong> Install the package first with <code>sudo yum install yum-utils<\/code><\/li>\n\n\n\n<li><strong>&#8220;yum: command not found&#8221;:<\/strong> The server runs CentOS 8 or later. Use the <code>dnf<\/code> commands in the Note under Step 4<\/li>\n\n\n\n<li><strong>The boot partition full issue returns after a few updates:<\/strong> <code>installonly_limit<\/code> was not saved in the <code>[main]<\/code> section, or a repeat entry later in the file overrides it. Check with <code>grep installonly_limit \/etc\/yum.conf<\/code><\/li>\n\n\n\n<li><strong><code>\/boot<\/code> is still almost full after cleanup:<\/strong> The partition is too small for even two kernels, which can happen with a 200 MB <code>\/boot<\/code>. Remove unused extras such as old <code>initramfs<\/code> rescue images only if you know how to rebuild them, or plan to resize the partition<\/li>\n\n\n\n<li><strong>The server booted into an old kernel after cleanup:<\/strong> The default entry in GRUB points to a removed kernel. Run <code>sudo grubby --default-kernel<\/code> and set the newest kernel with <code>sudo grubby --set-default \/boot\/vmlinuz-&lt;newest-version><\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To fix the boot partition full issue in CentOS, check <code>df -h \/boot<\/code> and <code>uname -r<\/code>, set <code>installonly_limit=2<\/code>, install <code>yum-utils<\/code>, and run <code>package-cleanup --oldkernels --count=2<\/code>. Keep the running kernel and one fallback, and never delete files from <code>\/boot<\/code> by hand. Because the limit now removes old kernels during each update, the problem should not return. CentOS 7 is also end of life, so plan a move to a supported system such as AlmaLinux or Rocky Linux.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions (FAQs)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What causes the boot partition full issue in CentOS?<\/strong><br>Each kernel update stores its files in <code>\/boot<\/code>, and CentOS keeps several old kernels by default. A small <code>\/boot<\/code> partition runs out of space after a few updates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Is it safe to delete old kernels from \/boot?<\/strong><br>Yes, if you remove them with the package manager and keep the running kernel plus one fallback. Don&#8217;t delete the files by hand.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>How many kernels should I keep?<\/strong><br>Two is a good minimum. It keeps the current kernel and one older kernel you can boot into if the new one has a problem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Does this work on CentOS 8, AlmaLinux and Rocky Linux?<\/strong><br>The idea is the same, but those systems use <code>dnf<\/code>. Set <code>installonly_limit<\/code> in <code>\/etc\/dnf\/dnf.conf<\/code> and use <code>dnf remove --oldinstallonly<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-install-lets-encrypt-with-apache-on-centos-7\/\">How to Install Let&#8217;s Encrypt with Apache on CentOS 7<\/a><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-add-swap-memory-on-aws-ec2-linux-instance\/\">How to Add Swap Memory on AWS EC2 Linux Instance<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to Our Technology Experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tired of disk space alerts and failed updates on your servers? Our team can monitor, patch, and maintain your Linux systems through our <a href=\"https:\/\/pheonixsolutions.com\/software-maintenance-and-support\/\">Software Maintenance and Support<\/a> services.<br><br><a href=\"https:\/\/pheonixsolutions.com\/contact\">Connect with our technology experts.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: December 12, 2020Last Updated: November 2026 Introduction This guide explains how to fix the boot partition full issue [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":13755,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[792],"class_list":["post-5980","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-architecture","tag-boot-partition","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-1ys","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2020\/12\/CentOS-Boot-Partition-Cleanup-Guide.png","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5980","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=5980"}],"version-history":[{"count":2,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5980\/revisions"}],"predecessor-version":[{"id":13757,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5980\/revisions\/13757"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media\/13755"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5980"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5980"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5980"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}