Search code examples
filesystemsinode

Largest size of a file from inode


Could someone explain me the answer to this. I got this in a quiz and couldn't answer it.

Assume that

  • All blocks in a disk are of size 4KB (4096 bytes).
  • The top level of an inode is stored in a disk block of size 4KB.
  • All file attributes, except data block locations, take up a total of 128 bytes (out of the above 4KB).
  • Each direct block address takes up 8 bytes of space and gives the address of a disk block of size 4KB.
  • Last three entries of the first level of the inode point to single, double, and triple indirect blocks respectively.

Question: What is the largest size of a file that can be accessed through direct block entries of the inode?


Solution

  • The calculations are quite simple:

    (( 4096 − 128 ) / 8 − 3) × 4096 = 2019328