The inode numbers in the partitions are blocks of numbers No. 0 and 1th.
I believe that everyone in the use of Linux has encountered the accidental deletion of file system data, whether it is their own mistakenly deleted or to help others to restore the wrong deletion
Now the more recovery tool is probably ext3grep, extundelete these two
Of course, this article is not to say the use of these two tools, but to describe each partition in the inode number 0 or 1th is exactly what
In the use of Ext3grep, Extundelete, there will basically be a step
Under Linux, you can use the "Ls-id" command to view the Inode value for a partition directory, and you can enter:
[[email protected]/]#ls –ID /2 /ls -ID /boot2 /Boot
As you can see, the Inode value is 2, not 0, or 1, regardless of the partition.
And when you search for the 0 or 1th inode with the Find command, you're not going to find anything.
Find/-inum0Find: '/proc/1461/task/1461/fd/5': No Such file or directoryFind: '/proc/1461/task/1461/fdinfo/5': No Such file or directoryFind: '/proc/1461/fd/5': No Such file or directoryFind: '/proc/1461/fdinfo/5': No Such file or directory
So where is the inode for the 0 or 1 block?
The relationship between boot sector and Superblock
When block is 1024x768 bytes (1K):
If the block size is exactly 1024, then the boot sector and Superblock will each occupy a block, which means that the boot sector is independent of the superblock.
[Email protected] ~]# dumpe2fs/dev/HDC1DUMPE2FS1.39( in-may-2006) Filesystem volume name:/boot .... (omitted in the middle) .... First block: 1Block Size:1024x768.... (omitted in the middle) .... Group 0: (Blocks 1-8192 ) Primary superblock at1, Group descriptors at2-2Reserved GDT blocks at3-258Block bitmap at259(+258), Inode bitmap at260(+259) Inode table at261-511(+260) 511 FreeBlocks1991 FreeInodes,2Directories Free Blocks:5619-6129Free inodes: -- -
See where the last special font is? Group0 's Superblock was started by block 1th.
The above results show that block No. 0 is reserved for boot sector.
When the block is larger than the bytes (2K, 4K):
If block is greater than 1024, then superblock will be at number No. 0!
[Email protected] ~]# dumpe2fs/dev/HDC2DUMPE2FS1.39( in-may-2006).... (omitted in the middle) .... Filesystem Volume Name:/1 .... (omitted in the middle) .... Block Size:4096.... (omitted in the middle) .... Group 0: (Blocks 0-32767 ) Primary superblock at0, Group descriptors at1-1Reserved GDT blocks at2-626Block bitmap at627(+627), Inode bitmap at628(+628) Inode table at629-1641(+629)0 FreeBlocks32405 FreeInodes,2directoriesfree blocks:free inodes: A-32416
Can be found Superblock on the first block (No. 0), but Superblock is actually only 1024bytes
For fear of wasting more space, the first block contains boot sector and Superblock
The results above show that because each block occupies 4K, but Superblock is actually only 1024bytes
So in the first block the Superblock occupies only 1024-2047 (from No. 0), and 0-1023 is reserved for the boot sector to use.
And the back of the 2048bytes space reserved
Now also understand why DF command so fast, it is to read each partition Inode 0 superblock inside the information,
In Superblock, the partition file system type, size, used size, usable size are saved.
We can use the TUNE2FS command to view information such as the block size of a partition
Tune2fs-l/dev/SDB1TUNE2FS1.41. A( --may- .) Filesystem volume name:<none>Last mounted on:<not available>Filesystem uuid:4814e6f2-6550-4ac5-bf2d-33109fc53061Filesystem magic number: 0xef53Filesystem Revision #:1(Dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype Needs_recov ery extent FLEX_BG Sparse_super large_file huge_file uninit_bg dir_nlink extra_isizefilesystem Flags:signed_direc Tory_hash DefaultMountoptions: (none) Filesystem state:cleanerrors Behavior:continuefilesystem OS Type:linuxino De count:65280Block Count:261048Reserved block Count:13052Free blocks:252525Free inodes:65269First block:0block size:4096 Fragment Size:4096Reserved GDT Blocks: theBlocks per group:32768fragments per group:32768inodes per group:8160Inode blocks per group:510Flex block Group size: -Filesystem Created:thu June 2 12:23:23 LastMount Time: Thu June2 A: -: . . LastWrite Time: Thu June2 A: -: . .Mount Count:1MaximumMountCount -Last Checked:thu June2 A: at: at .Check interval:15552000 (6 months) Next Check After:tue Nov in A: at: at .Lifetime writes: +mbreserved blocks UID:0(user root) Reserved blocks GID:0(group root) First Inode: OneInode size:256Required extra Isize: -desired extra Isize: -Journal Inode:8Default directory hash:half_md4directory hash seed:fad5ad24-52ef-482c-a54b-367a5bb4f122journal Backup:inode Blocks
The information above will tell you whether Superblock is in block 0 or block 1.
So where did the information from the above be read from?
The answer is: or Superblock
Superblock is so important that the system has done some protective measures against superblock.
The filesystem will have some spare super blocks, and the alternate super blocks are typically created in blocks 8193, 16384, or 32768
The Ext class file system manages a group of block partitions, and you can see the blocks per group line, which is that each group contains 32,768 blocks
Each group will have an alternate superblock, so the alternate super block is typically created in blocks 8193, 16384, or 32768, depending on the block size of the format
Tune2fs-l/dev/sda4 |grep Group
Blocks per group:32768
Fragments per group:32768
Inodes per group:8192
Inode blocks per group:512
Flex Block Group Size:16
Reserved blocks gid:0 (group root)
Note: Non-EXT class file system can not be used TUNE2FS command, and the principle and internal format with the Ext class file system is not the same!!
Tune2fs-l/dev/1.41. (-may- in andtrying to open/dev/sdb1couldn 't find valid filesystem superblock.
The above content for the Ext class file system, the wrong place welcome to shoot Bricks
Part of the reference to the Bird Brother article: http://vbird.dic.ksu.edu.tw/linux_basic/0230filesystem_6.php
The inode numbers in the partitions are blocks of numbers No. 0 and 1th.