Ext2: Difference between revisions

663 bytes removed ,  13 years ago
[unchecked revision][unchecked revision]
Line 510:
|}
 
== PuttingQuick it all togetherSummaries ==
=== How To Read AAn FileInode ===
# Read the superblockSuperblock to find the size of each block, the number of blocks per group, number Inodes per group, and the starting block of the first group (Block Group Descriptor Table).
# Determine which block group the inode belongs to.
# Read the first entry of the Group Descriptor Table, to find the location of the Inode table. get Inode 2, this will be the root directory.
# Read the Block Group Descriptor corresponding to the Block Group which contains the inode to be looked up.
# The directory information is located within the data blocks that the Inode points to, read all the data blocks associated within the Inode.
# From the Block Group Descriptor, extract the location of the block group's inode table.
# Interate through the directory information to find the directory/file.
# ReadDetermine the inodeindex bitmap to find out weatherof the inode pointed to byin the directory structure isinode allocatedtable.
# Index the inode table (taking into account non-standard inode size).
# if Allocated and is a directory go to step 3. If not allocated continue with step 4.
 
# Read the inode the block information, to get where the directory information is located.
Directory entry information and file contents are located within the data blocks that the Inode points to.
# Read the first 12 blocks, (if file is less then 12 blocks, only read the number of blocks needed specified by the inode (i.e to get the number of block the file takes, divide the size of the file by the size of each block).
 
# If is larger than 12 blocks.
=== How To Read the Root Directory ===
## Read indirect block.
The root directory's inode is defined to always be 2.
## foreach block larger than 12 blocks, read the pointer from the block. (i.e if reading block 13, pointer 1 from the block should be read).
## if the file needs more blocks. then read the double pointer will be a pointer to a block containing pointers to blocks of data.
## if the file still need more blocks, than read the triple indirect pointer.
 
== Links ==
Anonymous user