Page 1 of 1

Corrupt MBR

Posted: 14. Jul 2017, 08:32
by Atip
If the MBR is corrupted can it be repaired.

Sofar my attempts fail.

Code: Select all


sudo e2fsck  /dev/sda
e2fsck 1.43.1 (08-Jun-2016)
ext2fs_open2: Bad magic number in super-block
e2fsck: Superblock invalid, trying backup blocks...
e2fsck: Bad magic number in super-block while trying to open /dev/sda

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

/dev/sda contains `DOS/MBR boot sector, LInux i386 boot LOader; partition 1 : ID=0x82, start-CHS (0x0,1,1), end-CHS (0x2,254,63), startsector 63, 48132 sectors; partition 2 : ID=0x82, start-CHS (0x3,0,1), end-CHS (0x5,254,63), startsector 48195, 48195 sectors; partition 3 : ID=0x5, start-CHS (0x6,0,62), end-CHS (0x3ff,254,63), startsector 96451, 156204861 sectors' data
Tried those alternate superblocks and nothing changes.

Suggestions appreciated.

Re: Corrupt MBR

Posted: 14. Jul 2017, 10:08
by laprjns
Have you tried reinstalling the mbr using lilo?

Re: Corrupt MBR

Posted: 14. Jul 2017, 10:18
by DidierSpaier
File systems are inside partitions, not partitioned devices.

Assuming that you have a not mounted partition named /dev/sda1 for instance, type:

Code: Select all

sudo e2fsck /dev/sda1

Re: Corrupt MBR

Posted: 15. Jul 2017, 06:42
by Atip
Thanks all!

laprjns
Yes I did a few times. Nothing doing.

DidierSpaier
Good hint. Deleted sda1, put it back all using fdisk. Run lilo and MBR is back in action. :)

For such occasions it is handy to have a slackware USB boot stick.

Best

Re: Corrupt MBR

Posted: 15. Jul 2017, 07:54
by DidierSpaier
For the records: your MBR was most probably not corrupted. If it were you couldn't have booted at all. Maybe the filesystem in /dev/sda1 was corrupted (in which case e2fsck could have been used to repair it), we will never know as you didn't post the output of "sudo e2fsck /dev/sda1" before wiping out its content.

Actually, you didn't even tell why you felt the need to run this e2fsck command in your first post. Maybe nothing was corrupted :?:

Re: Corrupt MBR

Posted: 16. Jul 2017, 02:23
by Atip
Well I could not boot anymore to any of my bootable partitions. The display acted abnormal and booting would stop with kernel panic I think. Could, however, boot with slackware boot stick. Running lilo did not help and gave no errors.
Thinking that MBR resides in /dev/sda above /dev/sda1, therefore, I did not do e2fsck /dev/sda1.

After fixing /dev/sda1 all is well now. :)