A question was given to us by a lecturer:

How many data blocks are needed to collect all the data in an EXT4 file system using inodes if the file size is 54 KB and there is a block size of 4KB.

Answer: 15

The only explanation I can find is 54/4 = 13.5, which is round up to 14 data blocks and we add 1 inode block, so 15 blocks in total. What confuses me is that the question asks explicitly for data blocks, not inode blocks. Does this mean that an inode block is the same as a data block? Regardless of that, is the statement each file gets one inode block true, and does that apply only to EXT4 filesystem?

I have not yet gotten the explanation from a lecturer nor could I find one on the internet, thus I am asking it here. Please let me know, if it is not the right place to ask.

I thank for the answer in advance.

  • An inode contains data. Not file contents, but data none the less.
    – Kusalananda
    Jan 31 at 9:17

2 Answers 2


It's hard to know what they're thinking exactly (you'd have to ask them), especially since they talk about "all data on the FS" (not just one file), and mention "using inodes" (in plural).

But, one thing they might be referring to, would be the basic block addressing, which addresses the first 12 data blocks directly from the inode, and then allocates an extra block to contain the addresses of the next 1024 data blocks (assuming the usual 4 kB filesystem block size). For 14 data blocks, you'd need that one indirect block in addition to the inode itself, for a total of 15 data blocks.

However, that's a bit dated, since AFAIK ext4 usually uses extent-based mappings nowadays, meaning it stores just one entry for each contiguous run of data blocks. That means the amount of metadata needed depends on how fragmented the file is, but I'd assume the common case is that there are only a few extents needed, and they can be stored directly in the inode:

The root node of the extent tree is stored in inode.i_block, which allows for the first four extents to be recorded without the use of extra metadata blocks.

See "The Contents of inode.i_block" in the Ext4 Disk Layout document on wiki.kernel.org.


By default, ext4 filesystems are formatted today with 512-byte inodes, so there would be 8 inodes sharing each 4KB block. However, the inodes are statically allocated at format time, and are not allocated like data blocks are.

You must log in to answer this question.

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