Wednesday, February 17, 2010

Space is being consumed too fast? Find where!

You've found hat some process (don't know which) is eating up too much space too fast in one of your partitions and don't know where? Just yesterday I found a simple way to figure it out.

Suppose you want to check the partition where you have /home (which is in a separate partition from /, right?) where space is been eaten up too fast.

Run this simple command:

find /home -mount -type f -exec ls -s {} ';' > list_of_files1.txt

After it finishes running, wait for a little while (30 seconds, a minute, your call) and run the same thing outputting to a different file:

find /home -mount -type f -exec ls -s {} ';' > list_of_files2.txt

To find out what's going on, run a simple diff (a tool present in I guess every GNU/Linux system... if not unix) between both files and you should be able to see what's going on.

diff list_of_files1.txt list_of_files2.txt

You're welcome!

1 comment:

  1. JAK, great idea, Also there are some useful ways such:

    Linux List All Large Files

    To finds all files over 50,000KB (50MB+) in size and display their names, along with size, use following syntax:

    Syntax for RedHat / CentOS / Fedora /Debian / Ubuntu Linux

    find {/path/to/directory/} -type f -size +{size-in-kb}k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

    Search or find big files Linux (50MB) in current directory, enter:
    $ find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

    Search in my /var/log directory:
    # find /var/log -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'