Using Linux fsck to get you out of a jam

Well, not the best start to the weekend, One of my reliable and trusty dev servers decided to throw a wobble and toss the proverbial baby out of the bath water and give me a wonderful SuperBlock error. ūüė¶

Just for Google search the error was :-

mount: wrong fs type, bad option, bad superblock on /dev/mapper/Oracle_11G_Dev_Datap1,
       missing codepage or other error
       In some cases useful info is found in syslog Рtry
       dmesg | tail  or so

This is a Redhat Enterprise Linux version 5.9


So you turn to Google and off you go.

Now this site is worth a mention as it explains fsck pretty well


So off you go and try some of the commands

The issue is that there is a bad superblock, there are backup blocks though to find them you use

mke2fs -n /dev/mapper/mpath18p1

mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
214761472 inodes, 429522936 blocks
21476146 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
13108 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848



fsck -v /dev/mapper/mpath18p1

fsck 1.39 (29-May-2006)
fsck: fsck.ext4: not found
fsck: Error 2 while executing fsck.ext4 for /dev/mapper/mpath18p1

You notice many instructions with the following command fsck.ext4 as you see in the output above. What many people do not tell you is that you need a package installing

yum install e4fsprogs


So now the moment of truth, take one of the superblock number from the mke2fs command and try the

e4fsck command

e4fsck -b 98304 /dev/mapper/mpath18p1

e4fsck 1.41.12 (17-May-2010)
Adding dirhash hint to filesystem.

/u100 was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inode 7, i_blocks is 140000, should be 139888. Fix<y>? Y

And off you, a few hours later and many “y’s” being pressed it sprung back into life.


I am now looking for the commands to test / ensure that all is OK.

Good luck if you ever get this and I hope that this little bit of text works for you.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s