Linux fix the Superblock by DUMPE2FS fsck

Source: Internet
Author: User

It seems that there is a bad superblock. To fix this:

Firstly, boot into a live CD or USB

Find out your partition number by using

sudo fdisk -l|grep Linux|grep -Ev ‘swap‘

Then, list all superblocks by using the command:

sudo dumpe2fs /dev/sda2 | grep superblock

Replace to your drive number sda2

You should get a similar output as this

 Primary superblock at 0, group descriptors at 1-6 Backup Superblock at 32768, group descriptors at 32769-32774 B Ackup Superblock at 98304, group descriptors at 98305-98310 Backup Superblock at 163840, group descriptors at 163841-1638 Superblock at 229376, group descriptors at 229377-229382 backup superblock at 294912, group descriptors at 294 913-294918 backup superblock at 819200, group descriptors at 819201-819206 backup superblock at 884736, group descriptor s at 884737-884742 backup superblock @ 1605632, Group descriptors at 1605633-1605638 backup superblock at 2654208, Grou P descriptors at 2654209-2654214 backup superblock @ 4096000, Group descriptors at 4096001-4096006 backup superblock at 7962624, group descriptors at 7962625-7962630 Backup Superblock at 11239424, group descriptors at 11239425-11239430 Bac Kup Superblock at 20480000, group descriptors at 20480001-20480006 Backup Superblock at 23887872, group descriptors at 23 887873-23887878 

Choose an alternate superblock from the This list, the for the case alternate Superblock # 32768

Now, to check and repair a Linux file system using alternate Superblock # 32768:

sudo fsck -b 32768 /dev/sda2 -y

The flag is used-skip all the questions and to -y Fix? answer them all with a yes automatically

You should get similar output as this:

fsck 1.40.2 (12-Jul-2007)e2fsck 1.40.2 (12-Jul-2007)/dev/sda2 was not cleanly unmounted, check forced.Pass 1: Checking inodes, blocks, and sizesPass 2: Checking directory structurePass 3: Checking directory connectivityPass 4: Checking reference countsPass 5: Checking group summary informationFree blocks count wrong for group #241 (32254, counted=32253).Fix? yesFree blocks count wrong for group #362 (32254, counted=32248).Fix? yesFree blocks count wrong for group #368 (32254, counted=27774).Fix? yes........../dev/sda2: ***** FILE SYSTEM WAS MODIFIED *****/dev/sda2: 59586/30539776 files (0.6% non-contiguous), 3604682/61059048 blocks

Now try mounting the partition

sudo mount /dev/sda2 /mnt

Now, try-to-browse the filesystem with the following commands

cd /mntmkdir testls -lcp file /path/to/safe/location

If you were able to perform the above commands, you had the most probably fixed your error.

Now, restart-computer and you should is able to boot normally.

Linux fix the Superblock by DUMPE2FS fsck

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.