Unix I-node File System


#1

Q) Consider a UNIX-like file system implemented with i-nodes that resides on a disk of size 512 GB. Each i-node has a total of 15 block addresses consisting of direct and indirect lock addresses.

Suppose the implementation wants to support file size up to 2 GB using only direct block addresses and single indirect block address. At least how many of the 15 block addresses should be used as single indirect block address ?


#2

Each i-node has a total 15 block addresses which means 15 bit block addresses.
So each i-node size = (2^15)B.

Now let’s see how many i-nodes are required to address the entire disk space, i.e.512 GB

= Total Size / I-node Size

= 512 GB/ (2^15)B

= (2^39)/(2^15)

= 2^24

So ‘24’ bits are required to address the entire disk space which is equal to 3 Bytes.
That means Block Entry Size= 3 Bytes

Now to support file size up to 2 GB, we need to calculate the number of i-node or blocks required,

= File Size/ I-node Size

= 2 GB/ (2^15)B

= (2^31)/(2^15)

=2^16

Now to address 2^16 block we need a space = No_of_blocks * Block_Entry_Size = (2^16)*3 Bytes

Now question says to find out this space in units of block addresses, So just divide by 1 block size.

= (2^16)*3 / (2^15) = 2*3 = 6 block addresses