13. Linux EXT3 File System
In the standard ext3 file system, the content of each file is divided into two parts for storage, one is the attributes of the file, and the other is the content of the file. In ext3, inode and block are planned to respectively store the attributes of the file (in inode) and the content of the file (in the block area ). When the partition is formatted as an ext3 file system, it will certainly have the inode table and block areas.
Inode records the information about "attributes of the file and the block in which the file content is stored. A block is the region that records "file content data. In addition to recording file attributes, indoe must also have the pointer function, that is, pointing to the block where the file content is placed, so that the operating system can correctly obtain the file content.
Inode records the following information:
Owner and user group of the file (owner/group)
Access Mode of the file (rwx)
Type of the file)
The time when the file is created or the status changes (ctime), the last read time (atime), and the last modified time (mtime)
File Size
Define the flag of file attributes, such as SetUID...
Pointer to the real content of this file (pointer)
The size of an inode is 128 bytes.
When a directory is created in the linux ext3 file system, ext3 assigns an inode and at least one block to the directory. Inode records the related attributes of the Directory and points to the allocated block. Correlation of related files (or directories) in this directory
When a common file is created in the linux ext3 file system, ext3 will allocate at least one inode to the file and the number of blocks relative to the file size. Assume that a block is 4 kb and a kb file needs to be created. In linux, an inode and 25 blocks are allocated to store the file.
Inode itself does not record the file name, but records the relevant properties of the file. The file name is recorded in the block area of the directory, and the related connection record of the file is recorded in the block data area of the directory.
To read the content of a file, linux first obtains the inode of the upper-level directory of the file from the root directory, then, the inode of the file is obtained from the file associativity recorded by the Directory (in the block area of the Directory), and the final file content is obtained through the block pointer provided in the inode.
You can obtain the inode Of The/etc directory from the root directory of the operating system and read all the relevant attributes of the/etc directory.
According to the inode data of the/etc, you can obtain the associated data of all files in the/etc directory, and read the related content of the file in the directory.
From the block in the previous step, you can know the location of the inode of the crontab file and go to the inode
All attributes of the crontab file can be obtained from inode in the previous step, and the crontab file content can be obtained smoothly in the block area pointed to by inode.
The block and inodes are fixed at the beginning of formatting.
The number of files that a partition can accommodate depends on inode.
Generally, an inode is allocated for each 4 kb hard disk space.
The size of an inode is 128 bytes.
The block size is fixed, and 1024/2048/4096 bytes are supported.
The larger the block, the more hard disk space is consumed.
For a single file, if the block size is 1024, the maximum size is 16 GB. If it is 4096, It is 2 TB.
For the entire partition, if the block size is 1024, the maximum size is 2 TB. If it is 4096, It is 32 TB.
14. when an ext3 file system is created, it has superblock, group description, block bitmap, and inode bitmap) inode table, data block, and other regions
SuperBlock: records information about the entire file system. Without it, there is no such file system. The main information is:
-Total number of blocks and inode
-Number of unused and used inode/blocks
-Size of a block and an inode
-File System loading time, last Data Writing Time, last disk (fsck) time, and other file system information
-The valid bit value. If the file system has been loaded, the valid bit value is 0. If the file system has not been loaded, the value is 1.
Group Description: record where the block starts to record
Block bitmap (Block bitmap): indicates whether the Block is used.
Inode bitmap (inode bitmap): Specifies whether inode is used.
Inode table: it is the data storage area of each inode.
Data Blocks
# Dumpe2fs/dev/hda1 get this information in the file system
15. ext3 data access is recorded through logs, metadata, and data storage areas.
What file systems does linux support:
# Ls-l/lib/modules/'uname-R'/kernel/fs
The following file systems are currently enabled:
# Cat/proc/filesystems
16. Disk and directory capacity
# Df-ahTi lists all file systems. It is user-friendly. The file system name and inode Number of the partition.
# Du-ahs
17. Hard connection only writes one more associated data to a block in a directory, and does not use inode and disk space.
Author "allenhu0320"