Full Version: Where has my disk space gone?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Running Out of Disk Space?

Run du -sm /*. That will tell you how much space is used by each top level directory. Given the results from there, drill down to the next level. e.g. du -sm /var/*. Then drill down further e.g. du -sm /var/log/*.

Note. You can add the -h option (for human readable) to get a better reading. e.g.

du -smh /*
Alternatively, run:

du -mxS / | sort -n | tail

That will drill down and find you the biggest few individual directories. Do not use the -h option here as it would give out erroneous results.

The output will be something like:

212 /root
271 /home/fredemail/Maildir/.done/cur
311 /var/lib/mysql/forums
464 /var/spool/mail
465 /usr/local/tomcat/logs
1059 /home/adminemail/Mail
1089 /var/log/httpd

Another way to scan your filesystem for larger directories:

~# du -a --max-depth=3 / | sort -n | awk '{if($1 > 102400) print $1/1024 "MB" " " $2 }'
101.805MB /var/mail/root
101.809MB /var/mail
109.902MB /usr/bin
127.023MB /usr/lib/python2.5
145.105MB /usr/share/doc
146.012MB /var/lib
155.312MB /var/cache/apt
164.898MB /var/cache
173.789MB /var/www

Common big users of space are log files that keep growing and aren't truncated/rotated (e.g. with logrotate).

/var/cache/apt/archives using up a lot of space? Run apt-get clean. That will clear out the rpm files that apt downloads when it installs new RPMs.

Nine times out of ten most (possibly reclaimable) space is used up under /var or /home. /usr will typically be largeish (a GB or two) but its contents are typically required to run your server. Don't mess with /proc.
Reference URL's