[File System] dumpe2fs command

dumpe2fs - dump ext2/ext3/ext4 filesystem information
dumpe2fs prints the super block and blocks group information for the filesystem present on device.
some information you can refer to https://linux.die.net/man/8/dumpe2fs

-b print the blocks which are reserved as bad in the filesystem.
-h only display the superblock information and not any of the block group descriptor detail information.
-x print the detailed group information block numbers in hexadecimal format
-V print the version number of dumpe2fs and exit.

dumpe2fs This command can query the super block and blocks group file system information. This information contains the concept of block group, block bitmap, Inode bitmap, Inode table, Free blocks concepts. Following this link, there are very detailed explanation, https://www.kancloud.cn/wizardforcel/vbird-linux-basic-4e/152250

Summarized as follows:

    Newer operating system file data in addition to the actual file content, usually contain a lot of attributes, such as the Linux operating system file permissions (rwx) and file attributes (owner, group, time parameters, etc.). The file system will typically both part of the data are stored in different blocks, the attribute authority placed into the inode, as for the actual data block is placed into the data block. Further, there is a super block (Superblock) records the entire information for the entire file system, and includes a block of inode total use amount of the remaining amount. Each inode and the block has a number, as for the significance of these three data can be briefly described as follows:

Superblock : General information recording this filesystem, including inode / total block, the amount of the remaining amount, and the format of the file system and other related information;
 the inode : record file attribute, a file occupies a the inode, and records the file block number where the data resides;
 block : the actual contents of the log file, if the file is too large, it will take more than block.

    As each inode and the block has a number, and each file occupies a inode, there are block numbers placed in the file data inode. Therefore, we can know is that if we can find the file's inode, then you'll know the block number of the data file is placed, of course, will be able to read the actual data of the file.

Block Group

    And as mentioned in the previous section, inode and related rights in the content attribute record file, as the block is a block in the actual contents of the log file. And the file system inode and block the outset planned, unless reformatted (or use resize2fs and other instruction to change the file system size), otherwise it will not change after the inode fixed and block. But if you think about it, if I file systems of up to several hundred GB, then all of the inode and block all put together would be very unwise decision because inode number and block too big, not easy to manage.

    For this reason, therefore, when so Ext2 file system format is basically divided into a plurality of block group (block group), each group of blocks has a separate inode / block / superblock system. We feel like in the army, a battalion which has even divided into several, each even has its own liaison system, but eventually return on even the most accurate information to the general battalion! In this way into better manage groups of friends! Whole, the post Ext2 formatted somewhat like this:

ext2 file system diagram

    data block is used to place the local file contents data

1 . In principle, the size and number of the block formatting can be not completely changed again (unless reformatting);
 2 . At most a data file that can be placed within each block;
 . 3 . Deck, if the file is larger than block size, the number of a file will occupy a plurality of block;
 . 4 . From the previous, if the file is smaller than the block, the remaining capacity of the block is not able to be used again (wasting disk space).

    the Table inode (inode table)
again to discuss the inode this stuff it! As previously described in the content attribute record the inode file and the file the actual data which is placed within a few numbers Block! Basically, the inode file data are recorded at least the following:

The file access mode (Read / Write / excute the); 
owner of the document with the group (owner / Group); 
; file capacity of the 
time the file was created or state change (the ctime); 
last reading time (atime); 
last modification time (mtime); 
definition file characteristics flag (flag), as SetUID ...; 
the actual contents of the file to point (pointer);

inode number and the size is also when formatting has been fixed, in addition to some inode what style?

Each inode size was fixed at 128 Bytes (new ext4 and xfs can be set to 256 Bytes); 
each file can only occupy an inode only; 
bearing on, and therefore the number of file systems to create the inode related; 
when you need to find the file system reads the inode, inode and analyze user permissions and recorded for compliance, if they meet to be able to read the contents of the actual start of the block.

    Superblock (super block)

Superblock is the place to record the entire filesystem-related information, no Superblock, there is no such a filesystem. His recording of information are:

and the total amount of the inode block; 
unused inode already used / number block; 
the size of the block of the inode (block was . 1 , 2 , 4K, or inode as 128Bytes 256Bytes); 
filesystem mount time, latest data is written once time, the last test information about the disk (the fsck) the time of the file system; 
a valid bit value if this file system has been mounted, the valid bit is 0 , if not been mounted, the valid bit is 1 .

    Bitmap Block (Block Chart)

    If you want to add files always use block it! Which block that you want to use to record it? Of course, is to choose the "empty block" to record new data file Hello. Then how do you know which block is empty? This was to be assisted by a block bitmap of. From the block bitmap them know which block is empty, so our system will be able to find a space that can be used very quickly to dispose of the file Hello.

Similarly, if you delete some files, then those files originally occupied by the block numbers have to be released, among the flags of the block bitmap corresponding to the block number would have to be modified to be "not in use" Hello ! This is the bitmap function.

    Bitmap the inode (the inode table)

    In fact, this is similar to the block bitmap functions, just block bitmap records is to use the block number that is not used, as the inode bitmap is recorded using the inode number of unused Hello.

 

Guess you like

Origin www.cnblogs.com/xingmuxin/p/11904331.html