11. Operations of Adding a New File Store Properties Locate a free inodeas 47 Record the file information in the inode Store Data Locate disk blocks for file content such as 627, 200, and 992. Record Allocation Record the sequence of block numbers in the disk allocation section of the inode Add Filename to Directory Add the new entry (47, userlist) to the directory.
12. Looking inside a directory Directory is a special kind of file that contains a list of names of files. Ls – 1ia demodir //i for inode number Ls –ia / //root and parent of root //point to itself
13. The file system in practice What will happen when you type: > cat userlist The kernel searches the directory for the filename: userlist, inode number 47 found Locate the real inode 47 in inode table. The inode contains a list of data block numbers. Go to the data block one by one to read the data with read system call. The permission is also checked from inode
14.
15. STRUCTURE OF A REGULAR FILE The blocks marked "direct” contain the numbers of disk blocks that contain real data. The block marked "single indirect" refers to a block that contains a list of direct block numbers. To access the data via the indirect block, the kernel must read the indirect block, find the appropriate direct block entry, and then read the direct block to find the data.
16. STRUCTURE OF A REGULAR FILE The block marked "double indirect" contains a list of indirect block numbers, and the block marked "triple indirect" contains a list of "double indirect " block numbers refers to a block that contains a list of direct block numbers. Assume that a logical block = I K bytes A block number is addressable by a 32 bit (4 byte) integer. Then a block can hold up to 256 block numbers.
17. A single indirect data block can hold 256 block numbers (1024 bytes/4 bytes)