HOWTO: Repair a broken Ext4 Supe

2021-06-26  本文已影响0人  JasonXu123

1: sudo fdisk -l

The above will list all the partitions on all the drives in your computer. To recover a lost partition, your going to need Testdisk. Testdisk is included in Parted Magic, and there’s a great guide on their site. For this though, we just need the partition number, such as /dev/sda3 or /dev/hdb1.

Now, make sure your superblock is the problem, by starting a filesystem check, replacing xxx with your partition name. Here, you can change ext4 to ext3, or ext2 to suit the filesystem

2: sudo fsck.ext4 -v /dev/mmcblk9p4

      If your superblock is corrupt, the output will look like this

       fsck/dev/sda5

      fsck1.41.4 (27-Jan-2009)

      e2fsck 1.41.4 (27-Jan-2009)

      fsck.ext4: Group descriptors lookbad... trying backup blocks...

      fsck.ext4: Bad magic number insuper-block whiletrying to open/dev/sda5

         The superblock could not be reador does not describe a correct ext4  filesystem.  If the device is valid and it really contains an ext4 filesystem (and not swap or ufs or something else), thenthe superblock is corrupt, and you might try running e2fsck with an alternate superblock: e2fsck -b 8193 <device>

Now lets find where your superblock backups are kept.

3: sudo mke2fs -n /dev/mmcblk9p4

     Down at the bottom of this output, should be a list of the backups

    Superblock backups stored on blocks:

             32768, 98304, 163840, 229376, 

4: sudo e2fsck -b block_number  /dev/mmcblk9p4

    Now reboot, and your superblock should be fixed. If it’s not, repeat the steps, but restore a different backup superblock 

上一篇 下一篇

猜你喜欢

热点阅读