[HELP] How to fix the MBR from Linux


Recommended Posts

Recently, I installed Slackware again, as well as lilo. However, even though I can correctly boot to Linux, when I try to boot Windows XP (on a NTFS partition ) I get a BSOD (my first one ever) saying UNMOUNTABLE_BOOT_VOLUME.

I googled for it, and apparently the root cause is the MBR being unable to be read by Windows, but everyone sugests either using the XP install CD, or several floppies to download the boot disks, none of which I have.

So, is there a way for me to fix it from Linux?

Thanks in advance.

Edited by nav_uno
Link to comment
Share on other sites

Hmmm...  Get someone to send you the 512 byte MBR, then use a dd if=~/XP_mbr.bin of=/dev/hda bs=512 count=1 command (assuming you save the file locally in your home dir as "XP_mbr.bin".

586362613[/snapback]

Great, I feel hope now, can anyone please send it to me ? nav_uno@hotmail.com or PM me

EDIT: Do I need to uninstall lilo?

Link to comment
Share on other sites

Hmmm... Get someone to send you the 512 byte MBR, then use a dd if=~/XP_mbr.bin of=/dev/hda bs=512 count=1 command (assuming you save the file locally in your home dir as "XP_mbr.bin".

Link to comment
Share on other sites

When you install the XP MBR, you will boot without going to LILO at all. Straight to Windows.

I'm working on getting a copy of my wife's MBR to post here...

EDIT: Try this. I got it by using DamnSmallLinux running on QEMU while inside her running XP box. It should be valid, but I cannot guarantee. You have been warned. :unsure:

EDIT 2: Had to slap a ".txt" at the end of it, so Neowin would let me attach. :pinch:

XP_MBR.bin.txt

Link to comment
Share on other sites

When you install the XP MBR, you will boot without going to LILO at all.  Straight to Windows.

I'm working on getting a copy of my wife's MBR to post here...

EDIT: Try this.  I got it by using DamnSmallLinux running on QEMU while inside her running XP box.  It should be valid, but I cannot guarantee.  You have been warned. :unsure:

EDIT 2:  Had to slap a ".txt" at the end of it, so Neowin would let me attach. :pinch:

586362675[/snapback]

OK, I tried what you sugested, and now it's completely foobared, but it's my fault, you had warned me :cry:

Now the entire disks apears as free space, no partitions, no nothing. The partition table seems to be erased. I'm posting this on Knopix. Not even the bootdisk for Linux works, it throws a kernell panic error.

I'm running out of options, if it was only my PC, I wouldn't mind, but my sister uses it also, and I would like to fix it in case she wants to use it.

I'll try to install grub, and put the parameters on it hardcoded, to see if it boots either OS. Would it work without the partition table?

Any sugestions other than that?

Link to comment
Share on other sites

Whopee!! Apparently, Knopix has a very usefull tool called testdisk, that has allowed me to restore my partition table. Going to reboot now, and see how it turns out.

EDIT: This is me on my Slackware install. XP did not boot, but I mounted the partition, and everything is there, so, I can breath again, no files are lost.

Edited by nav_uno
Link to comment
Share on other sites

well thats good, im glad you fixed that, now as for your xp, i suggest not to do anything risky again like what mark said to do :p, and if you do, always make backups of files youre going to be replacing, my advice borrow a friends xp recovery disc and do it that way

Link to comment
Share on other sites

Yeah, I'm back to square one. I've re-installed lilo, hoping the MBR is in better state with mark's patch, and it boots Linux correctly, but XP still BSOD's.

The thing is, my friend has my XP install CD, and I doubt he'll be able to return it any time soon. And I've bought some floppies to get the boot disks, but the thing is that what you download from MS site is an .exe you have to execute from Windows, to create the boot disks.

And even though Mark's patch din't work, it was a very good learning experience. I had no idea how to restore the partition table before, but now I do, as well as how to write data to a specific part of the the disk. Thank god there's Knopix !

Link to comment
Share on other sites

Sorry... I had to take the kids to football practice, and I didn't get back home until now.

Also sorry that the MBR thing didn't work out for you, but very (VERY) glad you were able to recover what you could.

It sounds like your XP install is what is wrong, not your MBR. You will need your XP CD, and do a repair installation. This will re-wipe out your LILO, and you will need to reinstall LILO, but after that, you should have a working Windows and Linux install on your PC.

Link to comment
Share on other sites

Mark i figure the reason your method didnt work is because his partitions arent set up the same as the compouter you got that file from, therefore wouldnt it not be doing the right thing? Like his mbr is suppsoed to say boot from hda1 or something, but the windows you got your mbr file off of it says to boot from hda2? I think that's the most logical reason it didn't work, and he can't just "replace" his with that of another computer with a different setup, am i wrong in the assumption that all " XP_MBR.bin" are different depending on your pc?

Link to comment
Share on other sites

You are right! I just did a bit of research (link), and it seems that we only wanted the first 446 bytes, not the full 512 byte block. The first 446 bytes should be common from one XP to another (and from 98, too, from what I am told).

My error. :pinch:

Link to comment
Share on other sites

Ok, that seems right, I actually was thinking that after all got messed. So, what should I do? Do I need a different file, or do I use the same, but only copy the first 446 bytes?

Also, does the file renaming to .txt changes the content?

EDIT: Acording to the link, it says that the MBR program looks at the fist 512 bytes of the startable partition, and jumps to the program in that section. I wonder if that's what is wrong, and not the MBR itself, since it is able to contain lilo, and lilo boots well both Linux and a small Dell utility on the first 16 MB partition of the disk.

Edited by nav_uno
Link to comment
Share on other sites

If you modify your dd command to use a block size of 1 byte, and count 446 of them suckers:

dd if=~/XP_MBR.bin.txt of=/dev/hda bs=1 count=446

That should be much less destructive. (you could also just change the block size to 446, and leave count as 1)

The content of the file should not be changed by changing the extension on the file name, and the size of what I uploaded is exactly correct, so it didn't add any CR/LF to the file.

Question: Did you recover your partition table? Or did you just recover the files that were on it? </me being curious>

EDIT to your edit: Yes, that could be the problem. Your MBR could be correct, but point to code that is non-existent or incorrect.

Link to comment
Share on other sites

If you modify your dd command to use a block size of 1 byte, and count 446 of them suckers:

dd if=~/XP_MBR.bin.txt of=/dev/hda bs=1 count=446

That should be much less destructive.  (you could also just change the block size to 446, and leave count as 1)

The content of the file should not be changed by changing the extension on the file name, and the size of what I uploaded is exactly correct, so it didn't add any CR/LF to the file.

Question:  Did you recover your partition table?  Or did you just recover the files that were on it?  </me being curious>

EDIT to your edit:  Yes, that could be the problem.  Your MBR could be correct, but point to code that is non-existent or incorrect.

586365559[/snapback]

Yes I recovered the partition table using testdisk, and now all partitions, with every correspondant file are there. The disk is currently at exactly the same state it was when I first posted the issue, so, don't worry. ;) :p

I'll borrow an install CD from work to try and fix it, but I'm feeling a little adventurous, so before trying the repair from the install cd, I'll try the command you posted, since now I know it's best to first backup the MBR, and even if it goes wrong, I know how to fix it.

EDIT to your EDIT of my EDIT: Ok, though I noticed that windows starts to boot, and it gets to the screen with the progress bar below the XP logo before the BSOD, so I'm leaning towards believing that it should be the MBR, but I was curious about the health of the Windows partition, as I don't know for sure if it was the Slackware install that originated this, or if it was one of those days when Windows decides to hate you.

Edited by nav_uno
Link to comment
Share on other sites

Ok, though I noticed that windows starts to boot, and it gets to the screen with the progress bar below the XP logo before the BSOD, so I'm leaning towards believing that it should be the MBR

586365816[/snapback]

Well, if it makes it to any sort of boot screen, the MBR is fine. It only holds 446 (I know this now!) bytes of information - not enough for NTLDR. The MBR passes control to NTLDR or LILO or GRUB or whatever other boot loader is installed. You have a Windows problem. This one needs to be repaired by booting the XP CD and performing a "repair". It would also be wise to do a checkdisk before doing too much work at repairing. Your partitions have been through a lot, recently, and we need to make sure that your filesystem structure is intact.
Link to comment
Share on other sites

Ok, that's good to know, either way, I got a borrowed XP install CD from work, will try it as soon as I get home, and will chdisk the drive before anything. I'll keep you posted on the outcome. Thanks a lot for your support !

Link to comment
Share on other sites

Ok people, the plot thickens..... I just tried the XP install CD, and both the repair and setup options throw a BSOD. Now I don't get it, and have no clue what to do next. The windows partition is there, I can see it from Slackware. I uninstalled lilo to see if the XP CD worked, but nope, no luck.

Any sugestions ?

Link to comment
Share on other sites

Yes actually. At this point I would stop worrying about this, its not worth the trouble - somethings wrong with your XP installation. Backup everything you need from Slackware, then find somewya to store it outside of your PC, format everything and reinstall XP, then reinstall Slack... thats what I would do, I'm sure there's a way to fix this issue but I don't think its worth your time at this point, it would be faster to start fresh.

Link to comment
Share on other sites

The thing is, even trying to install XP from the install CD throws a BSOD. I'll try it one more time and let you know.

EDIT: I stand corrected, it now stays at "Examining startup environment", after selecting both "repair" and "install" options.

Edited by nav_uno
Link to comment
Share on other sites

  • 2 weeks later...

This is me, posting from Windows again. Unfortunately, I wasn't able to fix the old install. So I backed up as much as I could from Linux, deleted the partition, fixed the mbr, the boot sector, and only then could I proceed to re-install Linux.

I'm thinking that the hard drive might be failing, as the CHKDSK said there were unrecoverable problems, so I'll prolly need to get another one. Even on the new install, I sometimes get a BSOD while using Windows normally.

Anyway, thank you all guys for helping me su much, and providing great support, as usual in this site.

PS: Funny thing, I used to have XP Home, and now I installed PRO, and it never asked me for activation nor CD Key, even though I had formated the previous install.

Link to comment
Share on other sites

You could've booted your Windows CD, then do FIXMBR in the recovery console, then boot into Slackware using a bootdisk (a floppy) and run "lilo"...

Does your harddrive ever click?

Link to comment
Share on other sites

Can't edit my post, but I meant "re-install windows" not linux. And I had tried to boot to recovery console, but always got either a BSOD or the system just hanging, the only way I could made it boot from the XP cd was to completely delete the partition.

And what do you mean by click? I does makes some strange noises seldomly, about the same sound as when reading a floppy.

Link to comment
Share on other sites

And what do you mean by click? I does makes some strange noises seldomly, about the same sound as when reading a floppy.

586430212[/snapback]

Dead on. That harddrive is meant to fail :pinch: Those Maxtors out there are pretty cheap and durable :whistle:

By the way, try not to put your harddrive in the freezer or something like that, I've had a ton of harddrives fail at work and those techniques never worked ;)

Link to comment
Share on other sites

Maybe this has nothing to do with your problem, but a smilar thing happend to me when I messed with the format of my partitions and the windows drive letter changed. If the letter changes you cannot boot on windows anymore.

Example:

2 partitions of 10GB each one. One installation of windows in the first one (drive letter C:) and another one in the second partition (driveletter D:).

If you install linux or something that is not NTFS/Fat on the first partition, the driveletter will change to C for the second partition and your xp installation will be screwed up. There's a KB article on how to solve that but I prefered to format.

---

Link to comment
Share on other sites

Dead on. That harddrive is meant to fail  :pinch: Those Maxtors out there are pretty cheap and durable  :whistle:

By the way, try not to put your harddrive in the freezer or something like that, I've had a ton of harddrives fail at work and those techniques never worked  ;)

586443680[/snapback]

Update: Windows won't boot anymore (again) only this time, no BSOD, it just goes blank. When I try to mount the partition from linux, it says "bad option, wrong fs or bad superblock". But, when I use the recovery console I can see every file there.

Anyway, I know I'll have to buy a HD, which is why I'm currently evaluating different ones. Currently I'm just using Slackware, which also fails from time to time, throwing paging errors and an ocasional segmentation fault, but overall is workable still. I just wonder what the hell did I do to mess this up so bad.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.