# SA1:  Running out of disk space

## pjp

Navigation: [System Administration] [Table of Contents]

Safe to delete:

/var/tmp/portage

which can get filled if emerges are aborted (or crash?).

Unused kernel sources under /usr/src

"du -h --max-depth=1 /usr/src" will report how much space is being used.

Unused modules under /lib/modules

Delete only those modules associated with old kernels you are no longer using.

Unused firmware under /lib/firmware (see section Optional: Savedconfig of the Linux firmware wiki page)

Delete with caution:

*Above all else, please respect the donated hardware and bandwidth that is provided for Gentoo users.

/usr/portage/distfiles

Deleting all files in this directory should only be done if you are having serious issues with disk space.  Do not think downloading isn't a problem because you have "plenty of bandwidth."*  Consider using a script to delete only the files that aren't needed. More scripts are available here. Note that eclean is included in gentoolkit.

/usr/src

If you keep old kernels installed, you may be able to free up some disk space by removing them.  /usr/src/linux is a link to the currently used kernel, so be careful what you delete.  Also, a minor amount of diskspace can be restored from removing unused "arch"es in /usr/src/<kernel version>/arch/.

/usr/portage/packages/All

If you use portage's -b (--buildpkg) option, you probably have unused binaries in this directory.  Consider using a script such as eclean to remove old binaries.  If they are removed from this directory, you will likely be left with dead links from directories in /usr/portage/packages/ that symlink to All.  After removing the binaries, this script will remove the dead links:

```
#!/bin/bash

find /usr/portage/packages -xtype l -print0 |xargs -0 rm
```

Note:  You can replace 'rm' in xargs with 'echo' to see what it will do without removing anything.

/var/log/messages

And other log files.  These files can sometimes become very large.  Consider using a log rotating program, such as logrotate.

Do NOT delete:

/var/cache/edb if you use portage-2.0.50 or lower. Users of portage-2.0.51 can delete /var/cache/edb.

/var/db/pkg

Other:

tune2fs -m 0 /dev/hdaX

Normally there is some 5% of each partition reserved for the admin, with this command you can decrease it,in this case to 0%, but u can place other values as well. (suggested by defenderBG, 2007.May)

FAQ in progress, see this thread.  Other reference threads:  1, 2, 3.

Search keywords:  diskspace space disk

2022-11-02: Added reference to /lib/firmware savedconfig wiki page. --pjp

2006-06-22: Added note about eclean being included with gentoolkit.  --kallamej

----------

