How to free up space on RHEL6 /boot safely?

ams asked:

I am trying to do yum update on RHEL 6 box and I am getting this error message

Transaction Check Error:
  installing package kernel-2.6.32-279.9.1.el6.x86_64 needs 10MB on the /boot filesystem
  installing package grub-1:0.97-77.el6.x86_64 needs 10MB on the /boot filesystem

Error Summary
-------------
Disk Requirements:
  At least 10MB more space needed on the /boot filesystem.

My /boot has the following

# ls -lah /boot
total 74M
dr-xr-xr-x.  5 root root 2.0K Jun 10 08:05 .
drwxr-xr-x. 23 root root 4.0K Aug 27 03:08 ..
-rw-r--r--   1 root root  99K Apr 26 12:53 config-2.6.32-220.17.1.el6.x86_64
-rw-r--r--   1 root root  99K Feb 10  2012 config-2.6.32-220.7.1.el6.x86_64
-rw-r--r--.  1 root root  99K Nov  9  2011 config-2.6.32-220.el6.x86_64
drwxr-xr-x.  3 root root 1.0K Mar 29  2012 efi
drwxr-xr-x.  2 root root 1.0K Jun 10 07:53 grub
-rw-r--r--   1 root root  15M Jun 10 07:53 initramfs-2.6.32-220.17.1.el6.x86_64.img
-rw-r--r--   1 root root  15M Mar 29  2012 initramfs-2.6.32-220.7.1.el6.x86_64.img
-rw-r--r--.  1 root root  15M Mar 29  2012 initramfs-2.6.32-220.el6.x86_64.img
-rw-------   1 root root 3.4M Jun 10 08:06 initrd-2.6.32-220.17.1.el6.x86_64kdump.img
-rw-------   1 root root 3.5M Jun 10 07:53 initrd-2.6.32-220.7.1.el6.x86_64kdump.img
-rw-------   1 root root 3.4M Mar 29  2012 initrd-2.6.32-220.el6.x86_64kdump.img
drwx------.  2 root root  12K Mar 29  2012 lost+found
-rw-r--r--   1 root root 168K Apr 26 12:55 symvers-2.6.32-220.17.1.el6.x86_64.gz
-rw-r--r--   1 root root 168K Feb 10  2012 symvers-2.6.32-220.7.1.el6.x86_64.gz
-rw-r--r--.  1 root root 168K Nov  9  2011 symvers-2.6.32-220.el6.x86_64.gz
-rw-r--r--   1 root root 2.3M Apr 26 12:53 System.map-2.6.32-220.17.1.el6.x86_64
-rw-r--r--   1 root root 2.3M Feb 10  2012 System.map-2.6.32-220.7.1.el6.x86_64
-rw-r--r--.  1 root root 2.3M Nov  9  2011 System.map-2.6.32-220.el6.x86_64
-rwxr-xr-x   1 root root 3.8M Apr 26 12:53 vmlinuz-2.6.32-220.17.1.el6.x86_64
-rw-r--r--   1 root root  171 Apr 26 12:53 .vmlinuz-2.6.32-220.17.1.el6.x86_64.hmac
-rwxr-xr-x   1 root root 3.8M Feb 10  2012 vmlinuz-2.6.32-220.7.1.el6.x86_64
-rw-r--r--   1 root root  170 Feb 10  2012 .vmlinuz-2.6.32-220.7.1.el6.x86_64.hmac
-rwxr-xr-x.  1 root root 3.8M Nov  9  2011 vmlinuz-2.6.32-220.el6.x86_64
-rw-r--r--.  1 root root  166 Nov  9  2011 .vmlinuz-2.6.32-220.el6.x86_64.hmac

here is the disk usage on boot

# du -h
13K ./lost+found
282K    ./grub
247K    ./efi/EFI/redhat
249K    ./efi/EFI
251K    ./efi
75M .

Problem is that when I got this severer at my ISP I used their default image for RHEL 6 which only allocates 100MB for /boot clearly this is not enough. How can I get around this problem, is it safe to delete any of the above files some of them seem to be on the disk more than once? Is there some way of expand /boot without re-imaging the machine?

My answer:


Delete at least one of the old kernels, as alexus said.

Then:

Edit /etc/yum.conf and specify the limit of the number of kernel versions to keep. It’s set to 5 by default, but your system seems to be capable of handling only two:

installonly_limit=2

Finally, complain to the VPS provider about the strange template. /boot is 500MB by default in a CentOS 6 installation.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.