Corrupt MBR

You have a problem with Salix? Post here and we'll do what we can to help.
Post Reply
User avatar
Atip
Posts: 539
Joined: 5. Jun 2011, 04:27

Corrupt MBR

Post 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.
User avatar
laprjns
Salix Warrior
Posts: 1105
Joined: 28. Aug 2009, 01:30
Location: Connecticut USA

Re: Corrupt MBR

Post by laprjns »

Have you tried reinstalling the mbr using lilo?
“Don’t you see that the whole aim of Newspeak is to narrow the range of thought?"
DidierSpaier
Posts: 518
Joined: 20. Jun 2016, 20:15

Re: Corrupt MBR

Post 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
User avatar
Atip
Posts: 539
Joined: 5. Jun 2011, 04:27

Re: Corrupt MBR

Post 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
DidierSpaier
Posts: 518
Joined: 20. Jun 2016, 20:15

Re: Corrupt MBR

Post 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 :?:
User avatar
Atip
Posts: 539
Joined: 5. Jun 2011, 04:27

Re: Corrupt MBR

Post 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. :)
Post Reply