GATE / CS ARCHIVE

GATE CSE 2019 / QUESTION 42

Maximum inode-addressed file size

Operating Systems · File Systems · Full GATE CSE 2019 paper

GATE 2019, Q42 2 marks · NAT
Report issue

File Systems

Question 42, GATE 2019: An inode has 12 direct pointers, one single-indirect pointer, and one double-indirect pointer. Blocks are 4 kB and each disk-block address is 32 bits. Find the maximum file-data size in GB, rounded to one decimal place; retain the official key's alternative unit ranges.
Tap to enlarge
Answer & solution

Official answer: 3.7 to 3.8 OR 4.0 to 4.1

Our answer: 4.0 under consistent binary units; alternate range retained

1. A block pointer occupies 32/8=4 bytes. Under the usual binary convention, one block is B=4096 bytes, so an indirect block stores 4096/4=1024 addresses.
2. Direct pointers address 12 data blocks. The single-indirect pointer addresses one metadata block containing 1024 data-block pointers, so it contributes 1024 data blocks.
3. The double-indirect pointer reaches a first-level metadata block containing 1024 pointers to second-level indirect blocks. Each second-level block addresses another 1024 data blocks. Its contribution is 1024²=1,048,576 data blocks.
4. Total file-data capacity is (12+1024+1,048,576)×4096=4,299,210,752 bytes. Metadata blocks are not part of the file's data size and must not be added to this total.
5. In binary GiB, divide by 230 to obtain 4.003952... GiB, rounding to 4.0. This is the conventional intended calculation even though the question prints GB.
6. Units matter. Taking kB as 1000 gives (12+1000+1000²)×4000=4,004,048,000 bytes: 4.0 decimal GB, or 3.7 GiB after rounding. Taking binary blocks but decimal GB instead gives 4.3, not an accepted supplied range. Preserve the official disjoint intervals 3.7–3.8 OR 4.0–4.1 rather than concealing this unit ambiguity.

Original paper, page 13 · Answer key