SuperblockExtX uses the superblock to store the basic file system category data. It is located 1,024 bytes from the start of the file system and has 1,024 bytes allocated to it. It has the fields given in Table 15.1. Table 15.1. Data structure for the ExtX superblock.
Bytes 58 to 59 contain a flag for the state of the file system, and the flag can have the bits shown in Table 15.2 set. Table 15.2. Flags for the file system state in the superblock.
The error handling method in bytes 60 to 61 identifies what the OS should do when it encounters a file system error. These values can be configured when the file system is created. It has one of the three values given in Table 15.3. Table 15.3. Values for the error-handling field of the superblock.
The creator OS value in bytes 72 to 75 identifies the OS that might have created the file system. Many Linux tools that create the file system allow the
Table 15.4. Values for the OS creator field in the superblock.
{% if main.adsdop %}{% include 'adsenceinline.tpl' %}{% endif %} The major version level in bytes 76 to 79 can have one of the values defined in Table 15.5. Table 15.5. Values for the major version field in the superblock.
If the major version is not set to the dynamic version, the values from bytes 84 onward might not be accurate. The dynamic in the version name refers to the fact that each inode can be a dynamic size, and the exact size is given in the superblock in bytes 88 to 89. The current Linux kernel does not support dynamic-
The concept of compatible, read only compatible, and incompatible features was discussed in Chapter 14, "Ext2 and Ext3 Concepts and Analysis." A field for each type exists in the superblock. It should be noted that some of the flags have been defined but are never used in the Linux code. Therefore, not all of these are in a standard Linux system. The compatible features can have the values given in Table 15.6; the incompatible features are given in Table 15.7; and the read only compatible features are given in Table 15.8. Table 15.6. Flag values for the compatible features in the superblock.
Table 15.7. Flag values for the incompatible features in the superblock.
Table 15.8. Flag values for the read only compatible features in the superblock.
Now that we have given the data structures and all the flags, let's look at an actual Ext3 superblock. We will use dd and extract out 1,024 bytes starting at offset 1,024. # dd if=ext3.dd bs=1024 skip=1 count=1 xxd 0000000: c053 1d00 ff9d 3a00 4cee 0200 4708 0b00 .S....:.L...G... 0000016: 6745 1d00 0000 0000 0200 0000 0200 0000 gE.............. 0000032: 0080 0000 0080 0000 a03f 0000 c9fd 1141 .........?.....A 0000048: c9fd 1141 3601 2500 53ef 0100 0100 0000 ...A6.%.S....... 0000064: da9d e83e 004e ed00 0000 0000 0100 0000 ...>.N.......... 0000080: 0000 0000 0b00 0000 8000 0000 0400 0000 ................ 0000096: 0600 0000 0300 0000 077a 06a5 1795 486e .........z....Hn 0000112: 9485 ecc4 486f 63e4 0000 0000 0000 0000 ....Hoc......... 0000128: 0000 0000 0000 0000 0000 0000 0000 0000 ................ [REMOVED] 0000224: 0800 0000 0000 0000 0000 0000 0000 0000 ................ [REMOVED] 0001008: 0000 0000 0000 0000 0000 0000 0000 0000 ................ Bytes 0 to 3 show us that there are 1,921,984 (0x001d53c0) inodes, and bytes 4 to 7 show that there are 3,841,535 (0x003a9dff) blocks. Bytes 20 to 23 show that block 0 is where block group 0 starts. Bytes 24 to 27 and 28 to 31 contain the number of bits to shift the number 1,024 (0x0400) in order to calculate the block and fragment sizes. Both values are 2, which means that the block and fragments are 4,096 (0x1000) bytes. Bytes 32 to 35 show that there are 32,768 (0x8000) blocks in each block group, and bytes 40 to 43 show that there are 16,288 (0x3fa0) inodes per group. With this information, we know the total size of the file system, where each block group starts, and how many inodes are allocated to each block group.
Bytes 76 to 79 show that we have the dynamic version of ExtX, so the bytes following offset 84 should be valid. We see in bytes 88 to 91 that the size of each inode is 128 (0x80) bytes. Bytes 92 to 95 have the compatible feature flags, and the flag for the journal (0x0004) is set, so we have an Ext3 file system. Bytes 96 to 99 have the incompatible feature flag value of 0x0006, which means that recovery should be done during the
There are many other values in the superblock that were not discussed. Their purposes will be discussed in the appropriate section, and you can extract them from the fsstat output given in the "File System Category" section of Chapter 14. |