HOWTO cleanup gentoo portage distfiles, packages that are unused (eclean)
eclean can be your friend, it is a part of the gentoolkit. If you don't have the gentoolkit: emerge gentoolkit.
eclean can cleanup distribution files and packages. Because you are a regular emerge --sync, emerge --update --deep --ask world sort of person, you will likely be using disk space on all those old packages you have upgraded out of.
eclean distfiles
eclean packages
DESCRIPTION
eclean is small tool to remove obsolete portage sources files and binary packages. Used on a regular basis, it prevents your DISTDIR and PKGDIR directories to infinitely grow, while not deleting files which may still be useful.By default, eclean will protect all distfiles or binary packages corresponding to some ebuilds available in the Portage tree. This is the safest mode, since it will protect whatever may still be useful, for instance to downgrade a package without downloading its sources for the second time, or to reinstall a package you unmerge by mistake without recompiling it. Sure, it's also a mode in which your DISTDIR and PKGDIR will stay rather big (although still not growing infinitly). For the 'distfiles', this mode is also quit slow mode because it requiries some access to the whole Portage tree.
If you use the --destructive option, eclean will only protect files corresponding to some currently installed package (taking their exact version into account). It will save much more space, while still preserving sources files around for minor revision bumps, and binaries for reinstallation of corrupted packages. But it won't keep files for less usual operations like downgrading or reinstalling an unmerged package. This is also the fastest execution mode (big difference for distfiles), and the one used by most other cleaning scripts around like yacleaner (at least in its version 0.3).
Somewhere in the middle, adding the --package-names option when using --destructive will protect files corresponding to all existing versions of installed packages. It will allow easy downgrading without recompilation or redownloading in case of trouble, but won't protect you against package uninstallation.
In addition to this main modes, some options allow to declare a few special cases file protection rules:
- o
- --time-limit is useful to protect files which are more recent than a given amount of time.
- o
- --size-limit (for distfiles only) is useful if you want to protect files bigger than a given size.
- o
- --fetch-restricted (for distfiles only) is useful to protect manually downloaded files. But it's also very slow (again, it's a reading of the whole Portage tree data)...
- o
- Finally, you can list some categories or package names to protect in exclusion files (see EXCLUSION FILES below).
Keywords:gentoo, portage, cleanup, portage cleanup, eclean, cleanup portage directory, cleanup portage storage /usr/portage/distfiles, /usr/portage/distfiles, cleanup of /usr/portage/distfiles