ext3 real disk occupation of a file

Youness HAFFANE youness254 at gmail.com
Tue Aug 18 21:43:15 UTC 2009


I see,
So for only the first 12 blocks, there is no need for extra blocks, but I
couldn't find any mathematical logic for the rest.
I explain :
I've tried to create many files to which I assigned a fixed number of
blocks, and the results are :
for a 13 block file till a 1036 block file I had 3 extra blocks added
and then it's 4 extra blocks added (for example a 3060 block file)
and for a 4000 block file, it's 5 extra blocks
for 5000 it's 6
and for 10 000 it's 11 blocks added!

so is there any logic?
or it depends on the machine (regardless if it is ext3, or another fs)?


Best regards

youness



On Tue, Aug 18, 2009 at 8:05 PM, Eric Sandeen <sandeen at redhat.com> wrote:

> Youness HAFFANE wrote:
> > Hi Eric,
> >
> > I have understood from the document, that for each file, we have 3 extra
> > blocks (indirect) that refer to  :
> >
> > - the group descriptor
> > - the block bitmap
> > - the inode bitmap
> >
> > Is that right?
>
> nope :)
>
> > If not, to what the indirect blocks refer to? and are there always only
> > 3 blocks for each file in ext2/3fs?
>
> No.  basically the extra blocks are for keeping track of where the data
> blocks are, or for keeping track of where more indirect blocks are,
> which in turn keep track of where the data blocks are.
>
> Maybe http://www.nongnu.org/ext2-doc/ext2.html#DEF-INODES has a better
> explanation:
>
> "There are pointers to the first 12 blocks which contain the file's data
> in the inode. There is a pointer to an indirect block (which contains
> pointers to the next set of blocks), a pointer to a doubly-indirect
> block (which contains pointers to indirect blocks) and a pointer to a
> trebly-indirect block (which contains pointers to doubly-indirect blocks).
> "
>
> It's all these indirect blocks that you're seeing.
>
> -Eric
>



-- 
Y.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/ext3-users/attachments/20090818/5c4ce760/attachment.htm>


More information about the Ext3-users mailing list