disk usage

Aaron C. de Bruyn ubuntu-server at darkpixel.com
Tue Jun 29 15:00:15 UTC 2010


On 2010-06-29 at 16:43:53 +0530, Kaushal Shriyan wrote:
> Hi,
> 
> I see df -h and du -hs difference.
> 
> root at test:/# du -hs * | grep G
> 2.4G    home
> du: cannot access `proc/1027/task/1027/fd/4': No such file or directory
> du: cannot access `proc/1027/task/1027/fdinfo/4': No such file or directory
> du: cannot access `proc/1027/fd/4': No such file or directory
> du: cannot access `proc/1027/fdinfo/4': No such file or directory
> 9.5G    usr

You do realize the command 'du -hs * | grep G' will tally up the
space used by each directory and then *filter out* anything that
doesn't have a 'G' in it?

In other words, 'du -hs *' could be counting tens or hundreds of
directories that could be up to 999 MB in size *each*, but your
grep command is filtering them out.

>From the example above, 2.4G for home and 9.5G for usr add up to
~12 GB.

The difference between the 'used' space in your 'df -h' command
and what you think is 'missing' is ~12 GB.

So I think you need to remove the '| grep G' from your 'df' command
and you will see what is taking up all the space.

(If you are doing 'du -hs *' from your root directory, you will
need to ignore the size of /proc, /dev, and /sys.

> root at test:~# df -h
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/sda1              70G   55G   15G  79% /
<snip>

You have 55 GB used, of which you can account for ~12 GB used
by /home and /usr.  That leaves ~43 unaccounted for--which is
being filtered out by only showing folders that are measured
as being 1 or more gigabytes.

-A




More information about the ubuntu-server mailing list