How can I change the default size of an inode when I create an ext2/ext3 filesystem?
by The editorial team
Contributed by Eugene Teo
The following information has been provided by Red Hat, but is outside the scope of our posted Service Level Agreements (https://www.redhat.com/support/service/sla/) and support procedures. The information is provided as-is and any configuration settings or installed applications made from the information in this article could make your Operating System unsupported by Red Hat Support Services. The intent of this article is to provide you with information to accomplish your system needs. Use the information in this article at your own risk.
It is possible to define a non-standard sized inode by using the mke2fs tool with an undocumented option, -I. The size of the inode has to be a power of two and between the size of EXT2_GOOD_OLD_INODE_SIZE (128 bytes) and size of blocks in bytes. One reason for doing this could be that user is going to use extended attributes. Extended attributes are arbitrary name/value pairs used to store system objects like Access Control Lists (ACL). If the size of the inodes is larger than the default size, then sufficiently small attributes can be stored in inode. However, use this option with caution because of compatibility issues. It may render the filesystem unusable on most systems. Use the command man 8 mke2fs for more details.
Below is a part of the source file of mke2fs. The source files can be downloaded from http://e2fsprogs.sourceforge.net/. As this is an undocumented feature, the code below shows what the -I option do.
The source file can be found under the directory e2fsprogs-1.39/misc/mke2fs.c
while ((c = getopt (argc, argv,
"b:cf:g:i:jl:m:no:qr:s:tvE:FI:J:L:M:N:O:R:ST:V")) != EOF) {
switch (c) {
...
case 'I':
inode_size = strtoul(optarg, &tmp, 0);
...
if (inode_size) {
if (inode_size EXT2_BLOCK_SIZE(&fs_param) ||
inode_size & (inode_size - 1)) {
com_err(program_name, 0,
_("invalid inode size %d (min %d/max %d)"),
inode_size, EXT2_GOOD_OLD_INODE_SIZE,
blocksize);
exit(1);
}
if (inode_size != EXT2_GOOD_OLD_INODE_SIZE)
fprintf(stderr, _("Warning: %d-byte inodes not usable "
"on most systems\n"),
inode_size);
fs_param.s_inode_size = inode_size;
}
Here are some examples how a user can specify the -I option:
# mke2fs -I 127 /dev/hda1 mke2fs 1.39 (29-May-2006) mke2fs: invalid inode size 127 (min 128/max 4096)
# mke2fs -I 4097 /dev/hda1 mke2fs 1.39 (29-May-2006) mke2fs: invalid inode size 4097 (min 128/max 4096)
# mke2fs -I 256 /dev/hda1 mke2fs 1.39 (29-May-2006) Warning: 256-byte inodes not usable on most systems ...
# mke2fs -j -I 256 /dev/hda1 mke2fs 1.39 (29-May-2006) Warning: 256-byte inodes not usable on most systems ... Creating journal (8192 blocks): done







April 24th, 2007 at 6:13 pm
This command has to be given in the terminal window. Whether we can have any solution in the GUI interface too.
Let me know at the earliest
Thanks & Regards
Abhishek
April 25th, 2007 at 8:26 am
“This command has to be given in the terminal window. Whether we can have any solution in the GUI interface too.”
No.
“Let me know at the earliest”
It is not courteous to express urgency when seeking volunteer help.
April 25th, 2007 at 9:29 am
“One reason for doing this could be that user is going to use extended attributes. Extended attributes are arbitrary name/value pairs used to store system objects like Access Control Lists (ACL)”
Please clarify. Does it mean that in order to use ACL the inode size must be greater than default? I recall that newer versions of GNOME have support for ACL in GUI and to enable it, it is sufficient to add acl option in fstab.