Article Title: the correct method for restoring EXT3Superblock in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Linux Ext3 File System Superblock error.
...... Bad superblock on/dev/hda4
After a colleague recovers, the data is erased. Later, I thought that the direct fsck restoration method was incorrect. The correct method should be as follows:
1. Obtain the size of the wrong disk (or device) block.
There are many ways to get it. For example,
# Tune2fs-l/dev/hda4 is actually 1 K in most cases.
2. Back up the current faulty disk.
Restoring a Superblock is also a risky process. Back up data after backup. If there are other idle devices, use the dd command to back up the content on the device.
3. Generally, a super block error is also a primary super block error. When the Ext2/Ext3 file system is created, we will also be prompted on the screen that we have backed up the super block in several places. How can we find out where these Super blocks are located? Let's look at the help information:
-B superblock Instead of using the normal superblock, use an alternative Superblock specified by superblock. This option is normally Used when the primary superblock has been upted. The loca- Tion of the backup superblock is dependent on the filesystem's Blocksize. For filesystems with 1 k blocksizes, a backup Superblock can be found at block 8193; for filesystems with 2 k Blocksizes, at block 16384; and for 4 k blocksizes, at block 32768.
Additional backup superblocks can be determined by using Mke2fs program using the-n option to print out where Superblocks were created. The-B option to mke2fs, which spec- Ifies blocksize of the filesystem must be specified in order The superblock locations that are printed out to be accurate.
If an alternative superblock is specified and the filesystem is Not opened read-only, e2fsck will make sure that the primary Superblock is updated appropriately upon completion of Filesystem check. |
4. Start recovery. If the file system block size is 1 K, we can use the following command to restore it:
#/Sbin/fsck. ext3-B 8193/dev/hda4
If the backup block (8193) is faulty, try 24577 (8192*3 + 1) or 40961 (8192*5 + 1 ).
You may also see that the storage location of the super block is based on the Rules 1, 3, 5, and 7. The specific location is in BlockSize (8192) * N + 1. This is the pattern in the space exceeding 500 mb. I don't know if it is less than 500 mb. Let me know. Thank you.