Clean /boot Partition in CentOS 6

linux, server

/boot Partition in CentOS 6 can be cleaned by removing old kernels.

These are the steps:

1. Check /boot partition (98% used)

# df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda1        93M   86M  2.1M  98% /boot
...

2. Check installed kernel

# rpm -q kernel
kernel-2.6.32-431.el6.x86_64
kernel-2.6.32-431.29.2.el6.x86_64
kernel-2.6.32-504.1.3.el6.x86_64

3. Install package-cleanup

# yum install yum-utils
# package-cleanup --oldkernels --count=2
=======================================================================================================================================
 Package              Arch                 Version                        Repository                                              Size
=======================================================================================================================================
Removing:
 kernel               x86_64               2.6.32-431.el6                 @anaconda-CentOS-201311272149.x86_64/6.5               121 M

Transaction Summary
=======================================================================================================================================
Remove        1 Package(s)

Installed size: 121 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : kernel-2.6.32-431.el6.x86_64                                                                                        1/1 
  Verifying  : kernel-2.6.32-431.el6.x86_64                                                                                        1/1 

Removed:
  kernel.x86_64 0:2.6.32-431.el6                                                                                                       

Complete!

4. Check /boot partition (67% used)

# df -h
Filesystem      Size  Used Avail Use% Mounted on
...
/dev/sda1        93M   59M   30M  67% /boot
...

5. Limit only 2 latest kernel for later updates

# vim /etc/yum.conf
   ...[edit yum.conf]...
   installonly_limit=2
   ...[edit yum.conf]...

Source:
http://www.if-not-true-then-false.com/2012/delete-remove-old-kernels-on-fedora-centos-red-hat-rhel/

Comments Off on Clean /boot Partition in CentOS 6