When working with RHEL 6 systems, it's common to encounter /boot partition space issues during kernel updates. The standard 100MB allocation often proves insufficient when multiple kernel versions accumulate.
# List all kernel packages installed
rpm -qa | grep ^kernel
# Check currently running kernel
uname -r
# View disk usage by kernel files
ls -lS /boot | grep $(uname -r | cut -d- -f1,2)
First, always verify you're not removing the currently running kernel (shown by uname -r). Then proceed with these commands:
# Remove old kernels (keeping 2 most recent)
package-cleanup --oldkernels --count=2
# Manual removal of specific kernel files (example for kernel-2.6.32-220.el6)
rm -f /boot/*2.6.32-220.el6*
yum remove kernel-2.6.32-220.el6.x86_64
If file removal isn't sufficient, consider these approaches:
# Temporary solution: install packages ignoring space check
yum --disableexcludes=all update --skip-broken
# Move grub to root partition (advanced)
mv /boot/grub /grub
ln -s /grub /boot/grub
Configure automatic kernel cleanup by adding this to /etc/yum.conf:
installonly_limit=2
clean_requirements_on_remove=1
For production systems, consider extending the /boot partition using LVM if available.
When working with RHEL 6 systems, a common issue arises when the /boot
partition runs out of space during kernel updates. The standard 100MB allocation in many default installations proves insufficient for maintaining multiple kernel versions and their associated files.
Before deleting anything, it's crucial to understand what each file represents:
# Breakdown of /boot contents:
- config-* : Kernel configuration files (safe to remove old versions)
- initramfs-*.img : Initial RAM disk images (keep current and previous)
- vmlinuz-* : Compressed kernel images (keep current and previous)
- System.map-* : Kernel symbol tables (safe to remove old versions)
- *.hmac : HMAC checksums (safe to remove with corresponding kernel)
- initrd-*kdump.img : Kdump initramfs (safe to remove old versions)
Here's a safe approach to free up space while maintaining system stability:
# Step 1: List installed kernels
rpm -q kernel
# Step 2: Verify current running kernel
uname -r
# Step 3: Remove old kernel packages (keep at least one previous version)
package-cleanup --oldkernels --count=2
# Step 4: Manually clean up residual files for uninstalled kernels
# Example for kernel version 2.6.32-220.el6.x86_64:
rm -f /boot/*-2.6.32-220.el6.x86_64*
If cleanup isn't sufficient, consider resizing:
# Check available space on volume group
vgs
# If space is available, extend the logical volume:
lvextend -L +50M /dev/mapper/vg_boot-lv_boot
resize2fs /dev/mapper/vg_boot-lv_boot
To avoid future space issues:
# Configure yum to automatically remove old kernels
echo "installonly_limit=2" >> /etc/yum.conf
# Schedule regular cleanup
echo "0 3 * * 0 root package-cleanup --oldkernels --count=2 -y" > /etc/cron.d/kernel-cleanup
Always verify system bootability after making changes:
# Check grub configuration
grubby --info=ALL
# Verify initramfs for current kernel
lsinitrd /boot/initramfs-$(uname -r).img | head -10
# Test that the system can find the kernel
grub-install --recheck /dev/sda
Remember that while removing old kernel files is generally safe, always maintain at least one known-good previous kernel version as a fallback option.