ltsun
asked on
bytes per inode question
Dear experts,
My question is about bytes-per-inode when formatting a partition. The followings are what I did:
#mke2fs -i 8192 /dev/hda3
#mount /dev/hda3 /tmp/mydir
#cd /tmp/mydir
#mkdir hello
#ls -al
drwxr-xr-x 2 root root 4096 Oct 23 16:28 hello
#
I already indicated one inode points to 8192 (2 blocks) bytes. Since a directory uses one inode, I suppose the size of the directory should be 8192. But it seemes that I am wrong. Why the directory size is 4096?
Thanks in advance
ltsun
My question is about bytes-per-inode when formatting a partition. The followings are what I did:
#mke2fs -i 8192 /dev/hda3
#mount /dev/hda3 /tmp/mydir
#cd /tmp/mydir
#mkdir hello
#ls -al
drwxr-xr-x 2 root root 4096 Oct 23 16:28 hello
#
I already indicated one inode points to 8192 (2 blocks) bytes. Since a directory uses one inode, I suppose the size of the directory should be 8192. But it seemes that I am wrong. Why the directory size is 4096?
Thanks in advance
ltsun
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can not change the size of an inode without modifying kernel source code. Inode size is fixed! The 'i' switch to the mke2fs command affects the _number_ of inodes, not their size.
ASKER
MFCRich,
I got the idea. Thanks very much.
ltsun
I got the idea. Thanks very much.
ltsun
there are currently two thoughts I have here:
the inode size defines the maximum space that can be used within an inode. If the directory listing is smaller than the required space, it may not be needing all of the 8192 bytes initially. Once the directory index exceeds the required size, the structure gets expanded.
and secondly, according to my quick browse through the sources, I doubt somehow that you can allocate inodes of this size . The maximum (according to the sources in 2.2.19 kernel ) is 4096 bytes. Since mke2fs is not a kernel tool, it may have attempted to do more.
Both of which may account independantly. You may want to check the block size tune2fs -l /dev/hda3 too see if you actually got 8192 or 4096.
K.