I recently began receiving messages from one of our Cpanel servers that said DISKCRITICAL blocks: Mount Point “/boot…”., Basically, this means your boot partition has filled up. I’ve been burned in the past by CPanel’s default recommended partitions being too small after a while so I thought “oh great, here we go again”. But it turns out, this is a simpler fix.
Cpanel (or any Linux distribution, even without CPanel) makes assumptions upon install about the size of various partitions on the device. One such partition is the /boot partition. The /boot partition contains the operating system kernel. You can think of this as the core of your Linux install. It is the bridge between your hardware and the operating system. This is compiled specifically for your device architecture. (As a side note, I’ve been working with Linux kernel development for arm processors lately and it is interesting and fun). Without the kernel, you cannot boot Linux. Also, the kernel size can vary by what is installed (i.e. drivers supported, etc).
Since the kernel is so vital, Linux often keeps some of the old kernels installed on the system. When booting, your BIOS calls your bootloader (i.e. Grub, Barebox, etc), then your bootloader calls your kernel. So you could tell your bootloader to load a different kernel if you upgraded the kernel and an error prevented it from booting. Since there are a number of kernels saved, you can delete some of these and save space. The above error message occurs because the boot partition got full. And that is probably due to a bunch of old kernels sitting around.
The easy solution is delete one or more unused kernels. I would estimate that this saves you at around 15mb of space per kernel. But remember, this is a rough estimate based on a general server X86-64 install and your mileage may vary.
Check space in your boot partition
You can view space in your partitions by issuing a “df” command. Look for the /boot partition row. If you were receiving error messages, it is probably over 90% full. (As a quick aside, the -h in the command below means to make it human readable, allowing you to see M for megabytes and G for gigabytes instead of a long string of numbers representing bytes).
Find the currently installed kernel
On your server, type in:
This will give you the current kernel name. DO NOT DELETE THIS KERNEL. If you do, you can revert to using a different one, but headaches and stress lay ahead for those who do this!
Now find all kernels installed on the system:
rpm -qa |grep kernel
This will give you a list of kernels. Look for a format that is similar to the output from the uname command above. It should be something like this: “kernel-2.6.32…..x86_64”.
Now, stop, get some coffee, and think clearly.
Now delete the old kernels (NOT YOUR CURRENT KERNEL), by issuing the following command:
rpm -e kernel-2.6.32-XXX.X.X.el6.x86_64
Replace your kernel version with the one listed above. I put a few X’s in to make sure you don’t just copy and paste it!
Rerun the “df -h” command and confirm the space has been re-captured. Restart your computer to make sure everything is still running.