proper method to clean house
Do not do "make mrproper" for the /current/ kernel, or you won't be able to
emerge 3rd party modules. In /usr/src/linux (which should be a symlink to
the current kernel), do "make clean; make modules_prepare" instead.
To get rid of all kernel versions except the latest you installed:
emerge --prune sys-kernel/gentoo-sources
(Substitute gentoo-sources with the kernel you use -- it could be
hardened-sources or vanilla or bsd or...)
After this, you can rm -r the directories for the versions you removed from under /usr/src/
Just don't get rid of them if there still are kernels using them under
/boot -- sometimes you want to be able to boot into an older kernel.
Another few space savers:
check /usr/portage/distfiles, and remove the older versions of any source
package which you have more than one version of. (Or zonk it all if you
want to, but then you'll have to re-download the packages if rebuilding
anything.)
If you have gentoolkit installed, you might want to clean out
/usr/portage/distfiles automatically by running "eclean-dist" (will only
remove packages that no longer have an ebuild) or "eclean-dist -d" (to
remove everything except what you need for a reinstall).
For ccache, you can do:
# if compiling something, wait until finished.
cd /var/tmp/ccache
rm -f tmp.*
find . -type f -mtime +360 | xargs rm
# adjust 360 to fit your needs - any files that old in days will be removed
ccache -c # this one will take a while
To get rid of left-over files from emerge compiles:
cd /var/tmp/portage
rm -rf *
If running apache:
rm -f /tmp/sess_*
If running mysql:
# Unless you're running replication:
mysql -e "purge master logs before '`date +%Y-%m-%d` 00:00:00'"
# In any case:
/usr/bin/mysqloptimize -As
If using xfs (not the X font server, but the file system), emerge xfsdump
and run:
xfs_fsr -v
# This will defragment all xfs hard drives, which can free up some space
too, due to getting rid of unnecessary extents.
Then there's /var/log/... I recommend using the logrotate package or
similar, and make sure that logs are rotated and compressed every now and
then.
Good luck cleaning!
--
*Art
|