The correct way to restore EXT3 Superblock(bad superblock)

  
 

A few days ago I encountered a Linux Ext3 file system superblock error problem.

.... bad superblock on /dev/hdc1 A colleague made a recovery, the result is to erase the data Later, I thought that the direct fsck recovery method at the time was wrong. The correct method should be like this:

1 Get the wrong disk (or device) block size. There are many ways to get it. For example, #tune2fs -l /dev/hdc1 is actually 1 K. 2 for the current error disk backup. The process of restoring the superblock is also a risky process. If there are other idle devices, use the dd command to back up the contents of the device.

3 In general, the super block error is basically the main super block error, created in the Ext2/Ext3 file system. At the same time, we will prompt on the screen that we have backed up the super block in several places. So how do you find out where these super blocks are? Let us look at the help information: -b superblockInstead of using the normal superblock, use an alternativesuperblock specified By The option is normally used when the primary superblock has been corrupted. The loca-tion of the backup superblock is dependent on the filesystem'sblocksize. For filesystems with 1k blocksizes, a backupsuperblock can be found at block 8193; for filesystems with 2kblocksizes, At block 16384; and for 4k blocksizes, at block32768.

Additional backup superblocks can be determined by using themke2fs program using the -n option to print out where the superblocks were created. The -b option to mke2fs, which spec -ifies blocksize of the filesystem must be specified in order for 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 primarysuperblock Is updated responsive upon completion of the filesystem check.

4 Start recovery. If the file system block size is 1K, we can restore it with the following command:

# /sbin/fsck.ext3 -b 8193 /dev/hda4 if There is also a problem with the spare block (8193), then you can try 24577 (8192*3+1), or 40961 (8192*5+1).

You may also see that the super block is saved. It is according to the law of 1, 3, 5, 7. The specific position is in BlockSize(8192)*N+1. It is such a rule in the space of more than 500M. I don't know if it is less than 500M. Thank you.

Copyright © Windows knowledge All Rights Reserved