[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
https://www.neowin.net/forum/topic/357395-help-how-to-fix-the-mbr-from-linux/
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 ? [email protected] or PM me

EDIT: Do I need to uninstall lilo?

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".

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

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?

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

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

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 !

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.

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?

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:

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

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.

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
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.

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 ?

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.

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
  • 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.

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.

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 ;)

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.

---

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.

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

    • No registered users viewing this page.
  • Posts

    • Started implementing weapons! Here's a little sneak peek! 👀 Everything was done inside of Unreal Engine using Control Rig!
    • Keep in mind Intuit has lobbied like crazy to keep taxes complicated so they can continue to sell tax software. They also got caught hiding their legally mandated free version so they could release a second one that pushed countless people into charges they didn't need to pay to file. Intuit leads the charge on inventing problems so they can sell you the solution and disrespecting you in the process.
    • Oddly, there was a time that UFC games were culturally relevant, largely because of the graphics and gameplay that was different than the norm. But it seems like as the sport grew in popularity, gaming outlets stopped talking about the games.
    • Microsoft Edge 149.0.4022.69 by Razvan Serea Microsoft Edge is a super fast and secure web browser from Microsoft. It works on almost any device, including PCs, iPhones and Androids. It keeps you safe online, protects your privacy, and lets you browse the web quickly. You can even use it on all your devices and keep your browsing history and favorites synced up. Built on the same technology as Chrome, Microsoft Edge has additional built-in features like Startup boost and Sleeping tabs, which boost your browsing experience with world class performance and speed that are optimized to work best with Windows. Microsoft Edge security and privacy features such as Microsoft Defender SmartScreen, Password Monitor, InPrivate search, and Kids Mode help keep you and your loved ones protected and secure online. Microsoft Edge has features to keep both you and your family protected. Enable content filters and access activity reports with your Microsoft Family Safety account and experience a kid-friendly web with Kids Mode. The new Microsoft Edge is now compatible with your favorite extensions, so it’s easy to personalize your browsing experience. Microsoft Edge 149.0.4022.69 changelog: Fixed an issue that caused the Downloads dialog to continue displaying the "Keep/Delete" prompt for .rdp files after the download completed. Stable channel security updates are listed here. Download: Microsoft Edge (64-bit) | 193.0 MB (Freeware) Download: Microsoft Edge (32-bit) | 170.0 MB Download: Microsoft Edge (ARM64) | 188.0 MB View: Microsoft Edge Website | Release History Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Save 44% on Intuit QuickBooks Desktop Pro Plus 2024 (1 User for 1-Year) by Steven Parker Today's highlighted deal comes via our Apps + Software section of the Neowin Deals store, where for only a limited time, you can save 44% on Intuit QuickBooks Desktop Pro Plus 2024 (1 User + 1 Year) for Windows. Take control of your business finances with Intuit® QuickBooks® Desktop Pro Plus 2024 Lifetime Activation for Windows. This powerful accounting software simplifies bookkeeping, expense tracking, invoicing, and financial management—all in one intuitive platform. Designed for small business owners, freelancers, and accountants, QuickBooks® Desktop Pro Plus 2024 ensures accuracy, efficiency, and seamless transaction tracking. Stay organized, save time, and manage your finances with confidence—no subscriptions, just lifetime access! Financial and business management Comprehensive Financial Management: Gain access to a full suite of features designed to handle everything from creating invoices & managing expenses to generating reports and tracking sales. Enhanced Reporting Tools: Generate professional reports & insights to make informed financial decisions and help you stay ahead of your business goals. Job Costing: Track the profitability of specific jobs or projects. Fixed Asset Management: Track the depreciation & value of fixed assets. Customer & Vendor Management: Organize information, streamline communication & enhance customer relations. Sales Order Processing: Create & manage sales orders from start to finish. Purchase Order Processing: Create & manage purchase orders to streamline vendor payments. Improved Inventory Management: Enhanced features for tracking inventory levels & costs. Automation, integration, and support Enhanced Bank Feeds: Web Connect (manual QBO imports), works on all licenses for easier bank reconciliation Time Tracking: Track employee time to accurately calculate payroll and project costs Easy Data Import: Quickly transfer financial data from Excel or older QuickBooks® versions Why choose Intuit® QuickBooks® Desktop Pro Plus 2024? Effortless Installation: Quick and easy setup with step-by-step guidance. No Hidden Costs: One-time payment—no subscriptions or recurring fees. Direct Official Download: Access the software securely from the official QuickBooks® website. Stay Up to Date: Get the latest updates and features for optimal performance. Multilingual Support: Available in multiple languages to suit your needs. Lifetime Access: A one-time purchase means no ongoing costs. IMPORTANT: Cloud integrations (QuickBooks Payments, TurboTax, and Online logins) are NOT included. Good to know: Length of access: lifetime Redemption deadline: redeem your code within 30 days of purchase Access options: Windows Max number of device(s): 2 (for 1 user only and can't be used simultaneously) Version: 2024 (United States) 64-bit Available to both NEW and EXISTING users For US customers only Updates included An Intuit QuickBooks Desktop Pro Plus 2024 (1 User + 1-Year) for Windows: Lifetime License normally costs $536, but it can be yours for just $299.99 for a limited time, a saving of $236. There are also other plans available. For specifications, and license info please click the link below. Get Intuit QuickBooks Desktop Pro Plus 2024 for just $299.99 This is a time limited deal For US customers only. Support queries If you have queries or need support for any of the Neowin Deals, please use the contact form here. Neowin Deals are managed and sold by StackCommerce who represent Neowin on an affiliate basis. Why we post these deals We post these because we earn commission on each sale so as not to rely solely on advertising, which many of our readers block. It all helps toward paying staff reporters, servers and hosting costs. So for those that keep moaning and complaining, be thankful we're still online for you to even do that. Other ways to support Neowin Whitelist Neowin by not blocking our ads Create a free member account to see fewer ads Make a donation to support our day to day running costs Subscribe to Neowin - for $14 a year, or $28 a year for an ad-free experience Disclosure: Neowin benefits from revenue of each sale made through our branded deals site powered by StackCommerce.
  • Recent Achievements

    • Week One Done
      agatameier earned a badge
      Week One Done
    • One Month Later
      agatameier earned a badge
      One Month Later
    • Week One Done
      ssd21345 earned a badge
      Week One Done
    • Contributor
      MarkHughes4096 went up a rank
      Contributor
    • Dedicated
      jordanspringer earned a badge
      Dedicated
  • Popular Contributors

    1. 1
      +primortal
      507
    2. 2
      +Edouard
      175
    3. 3
      PsYcHoKiLLa
      139
    4. 4
      ATLien_0
      90
    5. 5
      Steven P.
      76
  • Tell a friend

    Love Neowin? Tell a friend!