Repair a Damaged Extended File System

We will replace its primary superblock assuming that it is corrupted, and then mount the file system back.

1.       Unmount the /dev/sda/test file system using the umount command:

# umount /dev/sda/test


2.      Execute the e2fsck command on its logical volume device file /dev/sda/test

# e2fsck /dev/sda/test
/dev/sda/test: clean, 11/73728 files, 13789/288768 blocks

This e2fsck utility is hard linked to fsck.ext3 and fsck.ext4 commands that may be used instead on the specific file system type.


3.      Obtain the list of backup superblock locations for this file system using the dumpe2fs command:

# dumpe2fs /dev/sda/test| grep superblock
Primary superblock at 0, Group descriptors at 1-1
Backup superblock at 32768, Group descriptors at 32769-32769
Backup superblock at 98304, Group descriptors at 98305-98305
Backup superblock at 163840, Group descriptors at 163841-163841
Backup superblock at 229376, Group descriptors at 229377-229377


4.      4. Run the e2fsck command and specify the location of the first backup superblock (32768) to repair the primary superblock:

[ Format : fsck –b <block number> <partition path>]

# fsck –b 32768 /dev/sda/test
e2fsck 1.42.9 (28-Dec-2013)
/dev/sda/test was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/sda/test: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda/test: 11/73728 files (9.1% non-contiguous), 13789/288768 blocks


5.      Mount the file system back:

# mount /dev/sda/test

Comments

Popular posts from this blog

Cambium cnPilot E400/E410/E500 Configuration Tutorial

Disabling Zimbra's AntiSpam, Amavis and AntiVirus filtering

Error "Unable to retrive Zimbra GPG key for package validation"