[CentOS] [Newbie] Reclaiming /boot space

Dr. Ed Morbius dredmorbius at gmail.com
Wed Mar 9 22:00:35 UTC 2011

on 15:39 Tue 08 Mar, Todd Cary (todd at aristesoftware.com) wrote:
> Simon -
> Did I screw up?  I deleted what was in /boot!

Yes, as others have noted.


1: Don't go randomly/arbitrarily deleting system files (unless you're
curious to see what happens when randomly deleting systems files).

2: Understand how Linux functions.  E.g.: the boot process, and the
significance of the /boot directory/filesystem.

3: Use your package management system.  If you /are/ going to delete
arbitrary system files, doing it through your package manager is going
to a) give you some idea when you're about to do something really stupid
(generally other Really Important Stuff depends on them) and b) at the
very least does the damage in an orderly manner.

4: Have a boot disk.  Know how to use it.

5: Know how to restore GRUB and an emergency boot kernel.

Circling back to #3:  your package management system can also dig you
out of this hole.

You should be able to identify and replace all files in an arbitrary
tree, for example, /boot, using an RPM bash one-liner:

    $ rpm -qa           # lists all packages installed
    $ rpm -ql <package> # lists all files in a package
    $ command | grep -q <expression>  # success/fail on match / no match
    $ command1 && command2  # runs command2 if command1 exits true
    # rpm -Uvh --replacepkgs <package list> # (re)installs packages
    $ $( command )  # executes output of 'command'

Putting that together:

    rpm -Uvh --replacepkgs $( 
        for pkg in $( rpm -qa ); 
            rpm -ql $pkg | grep -q ^/boot && && echo $pkg

Incidentally, the list of packages works out to:


Dr. Ed Morbius, Chief Scientist /            |
  Robot Wrangler / Staff Psychologist        | When you seek unlimited power
Krell Power Systems Unlimited                |                  Go to Krell!

More information about the CentOS mailing list