Chetan,

Couldn't trace the original messages in this thread - but based on what
was mentioned in the ILUG-BLR meet, the problem seemed to be that DU was
reporting 1 extra block usage when the file was stored under Ext2FS ??

The explanation is probably the following :

The E2FS filesystem stores direct links to the allocated blocks within the 
inode data structure itself if the filesize if less than 12 blocks - which 
would be 12288 bytes for 1K blocksize & 49152 bytes for 4K blocks. So for
files smaller than this limit, the disk usage would be identical to that
of a FAT file system with the same block(cluster)size. - i.e filesize divided 
by blocksize (rounded up to the next integer).

But since the inode cannot accommodate more than 12 direct references, it
allocates another block to store references to the next 256 blocks. So the
13th entry in the inode table actually points to a block which is used up
just for storing these references. 

So if your filesize happens to be between 13 & 268 blocks, your disk usage
would be the filesize divided by blocksize (rounded *up*) + 1.

For bigger files, I think there's yet another degree of indirection  
This block points to a block containing indirect pointers - each entry of 
which points to a block containing direct references. In this case the 
overhead would therefore be higher (though small when expressed as a 
percentage of filesize) .In fact the inode provides a triple indirection 
block pointer for really HUGE files !! (Not too sure about the exact details..
but I think you can find the info in the kernel source - Refer to the file 
ext2fs.h in the kernel source for details of these data structures.)

Regards,

Kala

Chetan Gopal Kashinath typed:
> what was the prob with du ( the thread that was skimpily existent on the list
> after two births and no explainations ) will anybody please get back into ur
> memory banks and fish out this bit of info for me ?? puulleeaase........
--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.

Reply via email to