On Wed, Nov 19, 2003 at 08:09:18PM +0530, Keith Fernandez wrote:

> Filesystem            Size  Used Avail Use% Mounted on
> /dev/hdb1             7.7G   33M  7.3G   1%   /vol2
> 
> THe size of the disk is 7.7 GB and it says available is 7.3 GB
> that means 400 MB is used, it however reports 33M is used, although
> the HDD is empty.

Two possible reasons - some space is actually used up in the
filesystem data, such as inode tables and superblock information in
case of extx. Also, the values in Gigs and Megs will have problems
rounding up ... try comparing the actual bytes used.

> And "du -sh /vol2" gives me
> 
> 37kB    /vol2
> 
> There is nothing on the partition /vol2. What could be the reason for this...

I believe this must be the size that is taken up by the filesystem
data itself ...

> "Deleted files/open files still held open are reflected in df but not du."

Thats true ... typical examples are the files in /var/log ... the
actual space taken up on the disk at a given time is different from
what the filesystem thinks is the size of the file ... df and du work
by looking at different sources for their information, hence the
discrepancy.

du will tell you exactly how many bites are taken up by the file. But
df will simply ask the filesystem to see how many blocks are allocated
to the same file. Thus if you create a file containing a single byte,
du will say "one byte" but df will say one block, that is 512 or 1024
bytes in most cases!

Since very few files are exact multiples of the block size, a little
space is wasted in every file - that's called internal fragmentation,
I think. Hence df will report more than the actual physical size - it
will show the amount of space that has been "allocated" to the file.

DISCLAIMER: These are my conjectures based on a little familiarity
with filesystems, somebody please correct me if I am wrong!

Sameer.
-- 
Research Scholar, KReSIT, IIT Bombay
http://www.it.iitb.ac.in/~sameerds/

-- 
http://mm.ilug-bom.org.in/mailman/listinfo/linuxers

Reply via email to