I'm reading about file systems and storage medium and I can't understand why if I create a one block size file I can't have a smaller inode than a one of a bigger file. Can't the OS dynamically choose the inode size according to the file size?

2 Answers 2


One reason for inodes to be fixed-size is that in the traditional Unix filesystem format (which e.g. ext4 still follows pretty closely), the inodes are stored in what is essentially a single table. With fixed-size items, locating an item based on its index number is trivial. With any other data structure it would require more work, and perhaps more importantly, more random-access reads across the data structure.

The size of the file itself doesn't influence the inode itself, which traditionally stores the location of the first couple of data blocks. For longer files, the system allocates extra blocks (indirect blocks) to hold the locations the rest. (See the wikipedia page for a pretty picture.)

I said "traditionally", since e.g. ext4 actually does things differently, it can save the contents of symlinks in the inode itself (they're often short, so it's useful to not allocate a full block), and the traditional tree of single blocks is replaced by a tree of extents, i.e. spans of several blocks.

As far as I can tell, on ext4 the reason for supporting inodes larger than the minimum size, is to allow for new fields to be stored, and to use the extra space for extended attributes. Looking at the table in the first link, the extra fields above the original 128 bytes on an ext4 inode mostly store higher precision time stamps. In SELinux systems, the security labels are implemented as extended attributes, so being able to store them directly in the inode can be very useful.

Newer filesystems like btrfs, XFS and ZFS with less orthodox formats are likely to do things differently, and I don't know much about the file systems used on, say BSD systems.


The inode itself holds file metadata and not any data. As such, it doesn't matter if the size is small or large. Also, inodes exist for things other than plain files. E.g. for named pipes, which have no data at all.

Having said that, the exact format and size of an inode is filesystem specific and can have any kind of behavior the designer of the filesystem wants. For Linux/Unix systems, the filesystem has to be able to provide a minimum set of information in the inode but filesystems can store more than that internally, both on the disk an in memory.

  • I thought that inodes had a pointers to the data blocks where the file is stored. So my question was about the number of pointers in an inode related to the number of data blocks within a file is split
    – sworwitz
    Oct 16, 2016 at 14:05
  • 3
    It may or may not have. E.g. ext2 and XFS have both direct and indirect references. The benefits however of a fixed-size inode outperform any potential space savings. Picture for example trying to read an inode from the disk that you don't know the size of. It will require at least 2 reads (one to get the size and one to read the data), or speculative read ahead, which will both be bad. With fixed size inodes the FS can also accurately compute the inode location within a larger block of data, which is the case for both ext2 and XFS.
    – V13
    Oct 16, 2016 at 15:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .