Fritz Thomas

20 Aug, 2009

How-To: Cleaning up Gentoo to get more free disk space

Posted by: Fritz Thomas In: Linux|Overall

You can safely empty some directory`s in Gentoo. But as always – first make sure if my suggestions are OK for YOU too!

# As superuser
gentoo ~ # emerge --sync
gentoo ~ # emerge -av gentoolkit
gentoo ~ # emerge -av --newuse --deep --update world
gentoo ~ # emerge -av --depclean
gentoo ~ # revdep-rebuild
gentoo ~ # rm -rf /var/tmp/portage/*
gentoo ~ # rm -rf /var/tmp/ccache/*
gentoo ~ # rm -rf /var/tmp/binpkgs/*
gentoo ~ # rm -rf /var/tmp/genkernel/*
gentoo ~ # rm -rf /usr/portage/distfiles/*
gentoo ~ # rm -rf /tmp/*

First, you have to install gentoolkit if you haven done this already. Then we remerge or update all packages where USE flags have changed. Then we are searching for unneeded dependencies and remove them. Finally we check if there are any packages with unresolved link dependencies, let them emerge and then clean up some directories.

Optionally you can defrag some of your partitions if this is neccessary. In case of XFS you can do this by:

gentoo ~ # xfs_db -r /dev/hda2

After this you should have a cleaned up gentoo environment, with no broken dependencies and no unneeded packages or libraries.

  • Digg
  • del.icio.us
  • DZone
  • MisterWong
  • Reddit
  • Slashdot
  • Technorati
  • Google Bookmarks
  • Facebook
  • Twitter
  • Yahoo! Bookmarks
  • Yigg
  • LinkedIn
  • MySpace
  • PDF
  • RSS

4 Responses to "How-To: Cleaning up Gentoo to get more free disk space"

1 | daid

September 17th, 2009 at 5:39 pm

Avatar

Generally a good list.

I’m not entirely sure the merit of cleaning out the ccache after you just updated though. Sure, it will save on disk space, but the point of ccache is to speed up subsequent rebuilds. If you’re just going to clean it out every time after you update, you might as well just not use the feature.

Also, while cleaning out distfiles is a good way to save local disk space, it puts a lot more pressure on the gentoo servers. I suggest keeping around the distfiles for anything you have installed, and just run eclean distfiles to remove the old ones. If everyone deleted all their distfiles after every update, the server load would go up probably an order of magnitude (rough guess).

2 | matt

December 31st, 2009 at 5:57 am

Avatar

thanks for the tip. freeing up the distfiles freed me up 5GB of diskspace. My root is only 20GB which I thought should be plenty but my disk hit 100%. I think its ok to remove the files in /usr/portage/distfile especially a little while after a fresh install or after installing gnome or kde. I’m still trying to free up more space because I think 20GB should be plenty and my gentoo is at 15GB. Ubuntu with a ton of packages installed was only around 12GB so we’ll see.

3 | Christian

February 2nd, 2010 at 12:41 pm

Avatar

rm -rf /tmp*

bad idea. at least do rm -rf /tmp/* but if things go worse it will skrew your X Session

4 | admin

February 2nd, 2010 at 12:53 pm

Avatar

Of course! This should be rm -rf /tmp/*

Comment Form



Latest Tweets