Suppose you have a Linux file system where the block size is 2𝐾 bytes, a disk…
2020
Suppose you have a Linux file system where the block size is 2𝐾 bytes, a disk address is 32 bits, and an 𝑖−node contains the disk addresses of the first 12 direct blocks of file, a single indirect block and a double indirect block. Approximately, what is the largest file that can be represented by an 𝑖−node?
- A.
513 Kbytes
- B.
513 Mbytes
- C.
537 Mbytes
- D.
537 Kbytes
Attempted by 113 students.
Show answer & explanation
Correct answer: B
Key idea: count how many data blocks the i-node can address (direct + single indirect + double indirect) and multiply by the block size.
Block size = 2 KB (2048 bytes).
Pointer size (disk address) = 32 bits = 4 bytes, so pointers per indirect block = 2048 / 4 = 512.
Direct blocks: 12 blocks → 12 * 2 KB = 24 KB.
Single indirect: 1 block of pointers → 512 blocks → 512 * 2 KB = 1,024 KB (≈ 1 MB).
Double indirect: one block points to 512 indirect blocks, each with 512 pointers → 512 * 512 = 262,144 blocks → 262,144 * 2 KB = 524,288 KB (≈ 512 MB).
Total blocks = 12 + 512 + 262,144 = 262,668 blocks.
Total bytes = 262,668 * 2048 = 537,944,064 bytes.
Convert to megabytes: 537,944,064 bytes ≈ 513.02 MiB (since 1 MiB = 1,048,576 bytes). Rounded for the question, this is approximately 513 MB.
Answer: approximately 513 MBytes.
A video solution is available for this question — log in and enroll to watch it.