Search code examples
unixoperating-systemfilesystemsfseekinode

Find the byte offset 8,62,000 (the UNIX v7 file system) using fseek


It is given it has 4kb disk block size, i-node for this file is given in the figure:

  1. find in which particular block will you get this offset ?

  2. what is the byte offset in that particular disk block?


Solution

  • I calculated that 862000/4096 will give me the logical block offset = 210 block no from where the i-node was defined.Also i found that direct blocks and single indirect can't be used.also i cannot use double indirect beacuse then the maximum logical block no offset would be 109(or 110 not sure),which means that the byte offset 8,62,000 must be fetched by triple indirect addressing .Further i found out that disk block no is 4092 and within that disk block 862000%4096 = 1840 is the byte offset.thus 862000 th byte of the file is byte 1840 of block 4092.