The correct way to restore EXT3 Superblock under Linux

  

Linux Ext3 file system super block (Superblock) error.

...... bad superblock on /dev/hda4

A colleague's recovery, the result is erased. Later, I thought that the direct fsck recovery method at the time was wrong. The correct method should look like this:


1 Get the size of the wrong error disk (or device) block.

There are many ways to get it. For example,

# tune2fs -l /dev/hda4 is in fact 1 K.

2 For the current error disk backup.

The process of restoring Superblock is actually a risky process. Be able to make backups and make backups. 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. When the Ext2/Ext3 file system is created, it will prompt us on the screen to back up the super block in several places. . So how do you find out where these superblocks are? Let's take a 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 Corrupted. The loca-
tion of the backup superblock is dependent on the filesystem's
blocksize. For filesystems with 1k blocksizes, a backup
superblock can be found at block 8193; for filesystems with 2k
blocksizes , at block 16384; and for 4k blocksizes, at block
32768.

Additional backup superblocks can be determined by using the
mke2fs 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 primary
superblock is update d shall 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 this spare block (8193) also has Problem, then try 24577 (8192 * 3 + 1), or 40,961 (8192 * 5 + 1).


You may also see that the super block is saved in the same way as 1,3,5,7. The specific location is in BlockSize(8192)*N+1. This is the rule in space over 500M. I don't know less than 500M. That person knows to tell me, thank you.

Copyright © Windows knowledge All Rights Reserved