Ext2 file System Related: Ext2 file system, a file in addition to the data need to store, some of the descriptive information needs to be stored, such as file type (general, directory, symbolic link, etc.), permissions, file size, creation/modification/access time, etc., that is, the ls-l command to see the information, This information exists in the inode rather than in the data block. But where the file name exists, first the file name is not in the inode, then where does the file name exist?
Here we can see the directory size is 4096, when you create a directory, the operating system will allocate a block (4096), the file name is the existence of the directory file, it is worth noting: when the file directory under a large number of files, the size of the directory file will increase. As shown below, the bin directory file size is larger than 69632.
Here's an example of the home directory:
The/home directory file contains a record entry, where the entry includes the file name and corresponding inode number, record length and other information.
Open () A/home directory for the file hello.c file addressing process, first find the home/home file data block, to match the file name of the record entry, if the match can get its inode number, and then the inode to obtain data pointers. Maybe someone will ask/home how to find it? The top level directory of the home directory is the root directory/, the operating system specifies that the root directory/must be placed on the Inode 2 number.
You can see that the inode for the/directory is 2.
When open ("/HOME/HSC/SS.C")
So the addressing process is: The operating system first finds the INODE2 data block, then obtains the home directory Inode number according to the record item match, obtains the corresponding data block according to the inode number, and then finds the HSC file Inode number according to the record item
Finally find the SS.C inode and locate the file.
Ext2 File System addressing