Saturday, May 22, 2010

Linux file as represented by the inode..( I have problem with my assignment question, please help me out)?

Consider the organization of a Linux file system as represented by the inode. Assume that there are 12 block pointers and a singly, doubly indirect pointer in each inode. Futher assume that the system block size and the disk sector size are both 4K. Moreover, the disk block pointer is 32 bits, with 8bits to identify the physical disk and 24 bits to identify the physical block within a disk.


a/ what is the maximum file size supported by this system?


b/what is the maximun file system partition supported by this system?


c/ Assume that the file inode is already in main memory, how many disk accesses are required to directly access the byte in 13,423,956?


2/ Redo question2 for a FAT32(MSDos/Windows)a file system assumming that all the 32 bits (instead of 24) of a disk block pointer (FAT entry) identify a physical block

Linux file as represented by the inode..( I have problem with my assignment question, please help me out)?
I took a shot at this, even refering to the


Unix file system description in the Maurice Bach


book, "The Design of the Unix Operating System".


I'm a little concerned that my numbers don't


quite line up with reality, so consider this


more a discussion than an authoritative


answer :-)








%26gt; Linux file as represented by the inode..( I have problem


%26gt; with my assignment question, please help me out)?


%26gt;


%26gt; Consider the organization of a Linux file system as


%26gt; represented by the inode. Assume that there are 12 block


%26gt; pointers and a singly, doubly indirect pointer in each


%26gt; inode. Futher assume that the system block size and the


%26gt; disk sector size are both 4K. Moreover, the disk block


%26gt; pointer is 32 bits, with 8bits to identify the physical


%26gt; disk and 24 bits to identify the physical block within a


%26gt; disk.


%26gt;


%26gt; a/ what is the maximum file size supported by this


%26gt; system?





If there are 12 block pointers in the inode,


and each block is 4K, then that makes 12*4K


or 48K directly addressable.





The indirect pointer points to an entire


block of pointers. If each block is 4KB, and


each pointer is 32-bits (4B), then there


should 1024 pointers in the block -- each


pointing to a 4K block. This means that


the indirect block covers 1024*4K bytes.





The doubly indirect pointer points to a


block of pointers which each point to a


block of pointers. In this case, it should


cover 1024 * 1024 * 4K bytes.





Adding them all up gives:





12*4K (direct)


1024*4K (indirect)


1024*1024*4K (doubly indirect)


------------


4198448 KB





4198448*1024 = 4299210752 bytes





or slightly over 4GB.





%26gt; b/what is the maximun file system partition


%26gt; supported by this system?





If there are 24 bits assigned to identify the


physical block, I guess the maximum file system


partition would be:





2^24 * 4K = 67108864KB = 68719476736 bytes





or about 64GB





%26gt; c/ Assume that the file inode is


%26gt; already in main memory, how many disk accesses are required


%26gt; to directly access the byte in 13,423,956?





Since the indirect pointer only covers 4MB, the byte in


question is in the doubly indirect block. So there would be


one disk access to read that block. Then there would be a


second disk access to read the singly indirect block that the


first block pointed to. Finally, there would be a third disk


access to read the disk sector which contained the data.








%26gt; 2/ Redo question 2 for a FAT32(MSDos/Windows)a file system


%26gt; assumming that all the 32 bits (instead of 24) of a disk


%26gt; block pointer (FAT entry) identify a physical block





I guess it means that there could theoretically be 2^32 * 4K.

geranium

No comments:

Post a Comment