[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [bug?] df and du -s output inconsistent?



Quoting Olaf Meeuwissen (olaf@epkowa.co.jp):
> 
> Yesterday I got an I/O error telling me that the /home file system was
> full.  Bummer!  Checked with df and sure 0% free in /home.  Looked all
> over /home to find disk hogs and removed a really big .xsession-errors
> file---still have to find out what caused that---and thought all would
> be well again.  Unfortunately, nope!  I'v since removed some more gunk
> and can work again, but ...
> 
> There is something funny about the output of df and du -s.  Just take
> a look at the typescript below:
> 
>   bash-2.03$ df /home
>   Filesystem           1k-blocks      Used Available Use% Mounted on
>   /dev/hda7              2058900   1652232    300239  85% /home
>   bash-2.03$ du -s /home
>   661643	/home
> 
> According to df about 1.6Gb of the /home partition are used whereas du
> -s says it about 1Gb less.  Who's wrong?  Or am I missing something?

You might want to read the thread "df and du disagree" from
last December. They are probably both right. If you fill your
disk up then, as well as removing the problematical file, you
need to fsck the disk. Much of the file is probably still marked
as "blocks in use", but du works through directories and only adds
up the files it can see (subject to mount points, permissions, etc.).
df just tells you what "used" and what's "free", without caring
about whether the used blocks are accessible.

Cheers,

-- 
Email:  d.wright@open.ac.uk   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.


Reply to: