Disk Cleanup

Phil Schaffner Philip.R.Schaffner at NASA.gov
Fri Jun 18 18:25:12 UTC 2004


On Thu, 2004-06-17 at 22:33 -0500, Clifford Snow wrote:


> On Thu, 2004-06-17 at 14:04, Per-Olof Litby - Reg'l Mgr Nordic/Baltic
> -
> Java System Software - Sun Microsystems wrote:
> > Greetings,
> > 
> > Being sort of a newbie to Linux, I was wondering if someone could
> post 
> > some hints as to what is the best way to free up space on a disk. I
> find 
> > myself  running out of disk space and would like to remove any 
> > uncessesary junk left over from upgrades, kernel builds, software 
> > installations, etc. Is there a good tutorial somwhere which tells
> me 
> > what I can delete and what not?
> 
> You can remove old kernels by using: 
> rpm -e kernel-2.(the old versions)  
> Run rpm -qa|grep kernel 
> to see what old kernels you have.  
> Run uname -r 
> to get your current kernel.
> 
> When I get around to cleaning things up, I like to leave at least the
> previous one and, of course, the current one.

If you have been doing custom kernel builds you will find old vmlinux-
<version> and initrd-<version>.img files in /boot.  Be sure to edit
/boot/grub/grub.conf to match what you clean up.

Old kernel sources are very large compared to the compiled kernels.


  rpm -e kernel-source-<version>

or for newer kernels:

  rpm -e kernel-sourcecode-<version>

If not installed by RPM, sources can be cleaned up while at a level
above the build directory by:

  rm -rf linux-<version>

For old update files - depending on update method:

  yum clean
  apt-get autoclean
  apt-get clean # more agressive

Seems like up2date should have a similar option but it's not obvious and
I don't use it.  Could do

  find /var/spool/up2date -type f -name "*.rpm" -exec /bin/rm {} \;

If you're desperate for space and feeling brave.

> I believe that rpm -e will also clean up grub.

And leave you with an unbootable machine? ;^)

Phil





More information about the fedora-list mailing list