Why does Windows setup lay down a new boot sector?

Date:December 20, 2005 / year-entry #392
Tags:other
Orig Link:https://blogs.msdn.microsoft.com/oldnewthing/20051220-16/?p=32903
Comments:    77
Summary:Why does Windows setup lay down a new boot sector? Because the alternative is worse. You would expect that after installing an operating system, the operating system should boot. If your boot sector is damaged, say because this is a brand new hard drive with no boot sector, or because it was infected with a...

Why does Windows setup lay down a new boot sector? Because the alternative is worse.

You would expect that after installing an operating system, the operating system should boot. If your boot sector is damaged, say because this is a brand new hard drive with no boot sector, or because it was infected with a boot sector virus, you expect the operating system's setup program to replace the boot sector with a good one. If it didn't, you'd have an operating system that didn't boot.

Not the greatest introduction to a new operating system.

I know some people are going to suggest, "Why doesn't the setup program ask before overwriting the boot sector?" But think about it. It's Christmas Day, you're installing Windows XP on your computer, you go through the setup process, and it asks you a question you can't answer. "Gosh, the computer says that I have a custom boot sector. It says that this could be for legitimate reasons, or it could be due to a virus. How the heck am I supposed to know the difference?" That's assuming they even read the dialog. A much more realistic scenario is, "Eek! The computer is asking me a scary question! How do I cancel out of this? I hate computers. They're so hard to use."

Yes, this means that if you are an ultradweeb with a custom boot sector, you will lose it when you install Windows. But Windows isn't picking on you. It even destroys itself. If you take a Windows XP machine and install Windows 2000 onto it, the Windows 2000 setup program will lay down a new boot sector that knows how to boot Windows 2000 but doesn't know about Windows XP. You'll have to restore the Windows XP boot files to restore that functionality.

[Update 9am: Even if Windows Setup did give you the option of "don't overwrite the boot sector" you still wouldn't like it. Windows Setup would get to the point where it lays down a new boot sector, and it says, "Ooh, an unrecognized boot sector, and the user said they want to leave it alone. Okay, I won't touch it. Now, how do I tell the foreign boot sector where I installed this operating system?" Since the authors of Windows Setup are not clairvoyant, they don't know what kind of boot sector you're going to have, so they won't know how to tell that foreign boot sector, "Please add 'Windows' to the list of known operating systems, and here is how you start it." The result: You just installed an operating system and have no way to run it.]

Things are a little better starting with Windows XP Service Pack 2 and Windows Server 2003 Service Pack 1, though. Those and future versions of Windows setup check the version of the NTLDR file and will leave a newer version of the boot loader intact rather than overwriting it with an older version. Let's just hope that you're not installing because you need a fresh boot sector...


Comments (77)
  1. Why should the user have to do an entire re-install just to get a new boot sector though? If this is truly an issue that arises often (which I can’t imagine it does — in 10+ years of using Windows in heavy dev work doing very crazy things, I’ve never once managed to destroy my boot sector), then fdisk /mbr would fix the problem.

    I guess a reinstall just seems heavy-handed to me. But then again, I’m not exactly the target audience either. ;-)

  2. Xavier says:

    Aaron, you don’t have to run the whole install to restore the boot sector; you can use the ‘fixboot’ command in the recovery console:

    http://www.microsoft.com/resources/documentation/Windows/XP/all/reskit/en-us/Default.asp?url=/resources/documentation/Windows/XP/all/reskit/en-us/prkd_tro_bohs.asp

  3. HA HA HA says:

    <i>Because the alternative is worse.</i>

    in tehm fiave inocent litl wrods lies 95% of sofware davelepmant.

  4. timor says:

    Why there isn’t some way to tell setup not to overwrite the bootsector, like some well hidden advanced options menu…

  5. Rosyna says:

    Isn’t this more a limitation of the standard PC BIOS than something Windows shouldn’t or should do?

  6. zzz says:

    How do I setup the recovery console on a USB stick? My thin laptop does not have cd/dvd and of course the recovery console was not installed on the computer before the bootsector crapped. I’ve attempted to setup the needed files for recovery console on USB stick but gave up after few hours :-(

  7. Manip says:

    This isn’t Window’s fault, it is the bios’s. If you ask me (and nobody has yet) the bios needs a list of bootable OSs which the user can select via an optional menu (as per the bios preferences).

    So, if you install Windows, Windows will overwrite the "Windows" item to point to a new version of its bootstrap loader… And add a – "Windows #2" if the user wants to duel boot Windows.

    If however there is an entry for "RedHat" that points to another partition then having Windows overwrite its own named entry won’t cause that any problems (assuming you don’t destroy the RedHat partition).

  8. Diego says:

    I don’t think such reasons are reasonable at all, this is in fact IMO the most ugly part of windows installer

    You could apply some heuristics. ej: if you only have one partition or all the partition are microsoft operative systems, it’s ok to overwrite the boot sector.

    However if there’s a unknow partition it IS reasonable to expect that there’s another operative system installed and user should be asked. If overwriting the boot sector without asking is good to make the installer easier, asking the user what to do when you find a different operative system is also a way to make the insallation easier, specially when you consider that unlike other boot loaders windows boot loader doesn’t boot other operative systems.

    If we’re talking about usability, forcing people to boot from a emergency CD and restoring a boot loader from other operative system is not the best option.

    Also, IMO users are not supposed to install operative systems an such questions should be safe. Asking users o overwrite the boot sector is not worse than asking users if they need to reformat a partition. In fact, I think that it’s microsoft fault that users have learnt words that they never should have know – such as "formatting"

  9. mastmaker says:

    Aha! Tell me about it.

    I was trying to install WinME (for experimental purposes) on a different partition of an XP machine…..

    To cut a long story short….

    I had to pay $30 for a custom Undelete utility so I don’t have to reconstruct (Microsoft) Money files. (WinME knocked off ALL partitions and started to reformat the entire hard disk in earnest.)

  10. Derek says:

    Diego, say a user has a corrupt or damaged partition, and it no longer looks like a valid FAT32 or NTFS partition. The user reinstalls, Windows sees this partition, assumes it’s Linux or such, and doesn’t overwrite the boot sector. Now the user can’t get into Windows. Not a terribly happy start, just as Raymond pointed out.

    Personally I think an option hidden in some "advanced user" dialog is the best way to go, but there’s a limit to how much it’s useful/feasable to throw in, and while it’s just "one more option", everyone says that about the option they want.

    Sometimes you have to go with what works for 999/1000 users, and let the 1/1000 deal with it. Seriously, the guy with a custom boot sector is a power user, and should be able to handle reinstalling his boot sector. Yeah, it’s a little bit of a hassle, but it’s a hassle you accept when you decide to run different OSes on the same machine.

  11. TimMisiak says:

    I’m not sure it’s a good idea to ever leave the boot sector intact based on a version number. Assuming there’s some specific place in NTLDR that has the version number that can be checked before overwriting, it seems a virus could overwrite the boot sector with a version number that appears to be higher than the currently released version of windows, and would thus not get overwritten by a fresh install of windows.

  12. Derek says:

    Tim, I agree. That’s not a good change.

  13. Carlos says:

    Manip wrote:

    And add a – "Windows #2" if the user wants to duel boot Windows.

    "Duel boot" is right. I always loathed installing multiple (unco)operating systems on a single PC. Fortunately, VMware and Virtual PC provide a much simpler alternative now.

  14. ah-non says:

    Raymond quoth ‘A much more realistic scenario is, "Eek! The computer is asking me a scary question! How do I cancel out of this? I hate computers. They’re so hard to use."’

    Why not just have two modes of install – the standard, simple install, and the custom / advanced install for those who know enough to make the right decisions? That would avoid scary questions, and give power users the tools they need.

  15. Andreas Häber says:

    What about making a Windows version for professionals, like the people who really need such options and other options which are too fancy for most Windows users? Will that ever happen or will the only options be:

    1) Choose some other OS which asks these scary questions

    2) Use Windows but you have to fumble around to find all hidden settings and whatnot to be able to use the system properly.

    And this is a problem for at least science students, at least. The university/college may provide you with some non-Windows tool, and therefore you need to dual-boot if you also would like to use Windows for other tasks. And mathematic student is not the same as a comp.sci. student (and a comp.sci student does not have to know everything about Windows too, of course :)).

    Sure, Services For UNIX might be able to help you out, but for a lot of software it does not. For example in computer vision class I tried to use SFU for the tool we used, but it didn’t recognize SFU.

    But ok, hope that you won’t name one of the Windows Vista editions "Professional" or similar. Use "Business User" instead, since that is the market you’re aiming for with these policies.

    (Sorry for such a long rant, happily holidays. I fear that I’m just shooting at the messenger here :/)

  16. So why, when installing Windows XP w/SP2 on a hard disk that previously had Linux installed does it not write out a new boot sector?

    Instead, I get a STOP 0x7B error, and I have to boot back into Linux and zero the first 1Mb of the disk before Windows will install…

  17. Nate Silva says:

    Raymond, the “ultradweebs”, as you called them, might complain, but this is one thing that Windows setup gets right. For the vast majority of users computer == appliance. Not computer == my new toy to load up with multiple OSes.

  18. Steve Loughran says:

    I know this makes sense from a most-support-calls problem, but for those of us who do have >1 OS (i.e. we boot back to windows for gaming/AV editing), it is a real pain. WinXP refuses to play nice with the other operating systems that are out there.

    It may be "for our own good", but really it just comes over as antisocial.

  19. Mihai says:

    Looks like several ppl in this thread confuse "boot sector" with "partition table".

    I don’t see a problem with Windows writing the boot sector. It is about it’s own partition, the boot has to know how to load the OS, and you will not install Windows and Linux on the same partition :-)

    But I do have a problem with Windows overwriting the partition table (which it does), disabling boot managers and other things like this.

  20. Peter says:

    I agree with Raymond: it’s better to support the vastly overwhelming number of people who just want the OS to install instead of doing much for anyone else. The idea of an installation time switch doesn’t really help: it’s one more silly little thing to remember,

    and another thing for Microsoft to test.

    But here’s a clever alternate that doesn’t need a switch, will work for both advanced and non-advanced users, and won’t use up (many) system resources: save the old boot loader into a particular named file. Hard drive space is cheap; there’s no reason why the (IIRC) 512 byte MBR can’t just be saved. Then it’s just a simple matter of a a mini-utility to write the MBR from the saved value.

  21. vince says:

    I always found it interesting how Linux distributions handle dual-booting so gracefully (though admitidly they are forced to) but Windows can’t hack it at all.

    Even MacOS recognizes PPC Linux boot info and partittions properly.

    I know you can claim the average user wouldn’t care about getting this right, but it really comes across as Microsoft being A). Lazy or B). Sneakily making life difficult for people who use non-MS operating systems.

    So you can claim "it’s what you want, really" it really does come across MS as ignoring the customer, despite all your smarmy TV/magazine commercials to the contrary.

  22. Grant says:

    "What about making a Windows version for professionals, like the people who really need such options and other options which are too fancy for most Windows users?"

    In addition to Raymond’s 9am update, another reason you don’t want Microsoft writing options into the installer less than 1% of the population will use: it takes development effort away from features and bugfixes that might actually affect the other 99%.

    Raymond has written about this before I believe (although I can’t locate his blog entries on the subject at the moment) and http://silverstr.ufies.org/blog/archives/000879.html talks about the cost of fixing bugs, but it’s applicable to developing new software too. You have to decide where to spend your money, and writing and testing features hardly anyone uses isn’t a good way to spend development dollars.

    Ultimately, everytime you add a 2-choice option to software, you double the number of codepaths you have to test.

  23. Jerry Pisk says:

    This really answers the question of who’s the target audience for Windows. If you know enough to know what a boot sector (and partition table as Mihai points out) is then Windows is not the OS for you. Microsoft does not want you to use it. And then they wonder why people are switching to systems that can handle advanced scenarios. Kinda reminds you of AOL in their treating of people of newbies that have no clue – it works at first but once people become educated and learn things they will leave.

  24. Grant says:

    "This really answers the question of who’s the target audience for Windows. If you know enough to know what a boot sector (and partition table as Mihai points out) is then Windows is not the OS for you."

    I agree that you have to examine Microsoft’s target audience to understand why they don’t not spend development dollars on features few people will use.

    I disagree with the conclusion that just because you know how computers work that Windows is not an operating system you should be using. I also find it insulting that you would assume all Windows users are "n00bies" or "idi0ts". I have sat on IRC many a Sunday evening watching some *nix admin struggle to finish a Windows administration task he left til the last minute of the weekend because he figured it’d be simple because "Windows is used by idiots".

    Your comments are analogous to me claiming that once you know AC electricity works, you should go build your own generating plant, because using the one provided by the utility company is too "simple" for you.

  25. Valdas says:

    Now that I think about the Windows Setup, it is really not geared towards a "dweeb" user, I mean, look:

    1. User is asked (optionally) to install additional Storage drivers – not something a newbie would do

    2. User is asked to select partition and/or split the hard drive into multiple partitions and allocate space – again, not something a newbie would do.

    So why is it unreasonable to expect that user would want to leave boot sector intact?

  26. Rosyna says:

    vince, the Mac OS doesn’t suffer this problem as its firmware isn’t as braindead as the standard PC BIOS. In fact, when Windows supports EFI and PC makers start shipping EFI boards, this point should be entirely moot.

  27. Frank Richter says:

    I think the "clairvoyancy" argument is somewhat poor. I would expect that the same users that deliberately instruct setup to not steamroll over the bootsector because of some custom bootloader are able to change said bootloader’s settings to allow booting of the newly installed Windows.

  28. So Windows Setup should say "Okay, I put the Windows boot sector on drive 1, partition 0, sector 4816231. Good luck."?

  29. Kuwanger says:

    Grant, while I agree with some of your comments, you’re showing a good bit of bias in your response. What was being pointed out was that Windows and AOL are targetted at the computer illiterate, for the most part. That doesn’t make them idiots than more than most cars buyers not being mechanics.

    Having stated that, the major point that was brought up was that if Windows (and AOL) are targetted at an audience you’re not a member of, it doesn’t make sense to use said product(/service). This is both because currently the product(/service) isn’t providing what you desire and, since you’re not the target audience, the company involved isn’t interested in listening to you to know how to make the situation better for you. This is a large reason why all the proprietary computer diagnostic equipment in cars is not only driving away mechanics but should also be driving them away from purchasing such vehicles.

    Without a sort of olive branch to passify the computer literate, who are your developers, the only thing left to ride on is the presumption of making money on the platform. While there’s certainly commercial products, like Photoshop and Visio, that will keep some people on your platform, the majority of people use programs that are either part of the OS or freeware. And if these computer literate people start writing freeware for other OSs which do target them, then there because a lot less reason to continue to use Windows.

    I assume this is the reason that Balmer has stated the importance of developers and the reason that Vista is gaining a variety of features that are beneficial to the developer.

  30. Yuhong Bao says:

    These issues all go away with EFI, so it is already gone on Itanium-based systems. Also for EFI I recommend abandon EI Toerto (the CD-ROM booting standard), instead loading the Setup program directly from CD-ROM and running it just as any other EFI program.

    I think we should support these steps for Windows installation on EFI:

    1. Partition the disk using diskpart from EFI.

    2. Format the partition from EFI.

    3. Running Windows Setup from EFI, during setup specifing the directory which you want to install Windows.

  31. Brian Duffy says:

    "In addition to Raymond’s 9am update, another reason you don’t want Microsoft writing options into the installer less than 1% of the population will use: it takes development effort away from features and bugfixes that might actually affect the other 99%."

    That’s a lame excuse for a company like Microsoft that produces bloatware like .Net and Office.

  32. J says:

    "That’s a lame excuse for a company like Microsoft that produces bloatware like .Net and Office."

    Then shouldn’t you be praising the installer for not being bloated with features that only 1% of the population use?

  33. I agree with Peter, Windows setup should copy the existing boot sector to a file before overwriting. Power users then have access to that file if they need it, and the average user can ignore it (they probably would never see it assuming Microsoft hide the file).

    A few years back I added a Linux partition to my Windows PC. I nearly crapped my pants when I booted it and realized Linux over wrote the boot sector. Fortunately I quickly discovered Linux made a copy of the boot sector for me which I was able to restore.

  34. Cooney says:

    1%? I rather doubt 1% of the population ever installed windows in the first place. People buy a machine with windows already on it and, when it gets too bogged with spyware and viruses, they chuck it and get another.

    It’s only us geeks that install windows ourselves. Is it too much to ask for a non-destructive OS install? Hell, I’d be happy if it was part of the scripted install options.

  35. Ardeous says:

    "People buy a machine with windows already on it and, when it gets too bogged with spyware and viruses, they chuck it and get another. … It’s only us geeks that install windows ourselves."

    What facts do you have to back up these assertions? Anecdotal evidence of your grandmother’s PC usage doesn’t count.

  36. Andreas Haeber says:

    I’m not convinced that only 1% of the Windows users would need such a feature. Like already pointed out in an earlier article here (last month IIRC) most installations of Windows are automated. So, who is the users of the manual Windows Setup really for then?

    "So Windows Setup should say "Okay, I put the Windows boot sector on drive 1, partition 0, sector 4816231. Good luck."?"

    That would be quite fine, actually. Best would be to ask if you would like to have that info printed out or something similar :).

    I believe most users would prefer that a fresh installed OS can not be used due to some user-error, rather then the OS already installed and used for a long time suddenly gets inaccessible due to the new family member in the house. If you discover that you did something wrong then just rerun setup and choose the default option: "overwrite the bootsector, please". Windows Vista setup will only take approx. 20min anyways :P

  37. Manip says:

    Duel booting Windows 2000, XP and Linux (Any/Various). Requires at least three partitions.

    1. Install Windows 2000 (Partition 1)

    2. Install Windows XP (Partition 2)

    3. Install Linux (Partition 3)

    4. Setup Linux to boot Windows by default (Read man page for your bootloader)

    It isn’t rocket science. But yet it is amazing how hard people make the above, just by getting the order wrong…

    Rule of thumb:

    <Old Windows> <New Windows> <Old Linux> <New Linux>

  38. JanC says:

    I think Ubuntu has this right: they simply ask if you want to write the bootloader to the MBR (no scaring of people with talk about virusses or other malware!), with "Yes" as the default and a suggestion to leave it at that unless you really know what you’re doing. That way the "Christmas afternoon" Windows-installing newbie (who answers every question with "enter" anyway) will get what he wants. Microsoft could easily do the same without risking to scare away users.

    PS: *real* newbies never install Windows themselves, because it’s too difficult for them (or they are scared that it will be too difficult). Newbies let their dealer install software for them, or they ask one of their computer-literate family members (that’s you & me) to install it.

  39. Eri cK. says:

    @ Ha Ha Ha:

    "in tehm fiave inocent litl wrods lies 95% of sofware davelepmant."

    *Please* tell me that you’re *not* a developer.

    …Or at least tell me who you work for so I can steer clear. You have seven misspelled words, a capitalization error and two grammatical errors in a single eleven-word sentence.

    What could you accomplish, I wonder, with a million-line project and its accompanying documentation?

  40. Norman Diamond says:

    Actually there are cases where Windows setup doesn’t lay down a new boot sector.

    If you install Windows 98 after Windows NT4, then you can dual boot afterwards. I think Windows 98 rewrites the file C:BOOTSECT.DOS instead of the MBR. Windows 98 is far friendlier to existing Windows NT4 installations on other partitions that the current Windows 98 setup hasn’t been told to touch, than to existing Windows 98 installations on other partitions that the current setup hasn’t been told to touch.

    I even once had a case where a Windows 98 setup left LILO intact in the MBR. I think the order of operations was to boot LILO, tell LILO to boot the NT4 loader, tell the NT4 loader to boot Windows 98, and tell the Windows 98 loader to boot to a command prompt only. At that point I reinstalled Windows 98, and was astounded (though pleased) when the next reboot still brought up LILO.

    On the other hand, Windows NT4 pre-SP4 wouldn’t rewrite an MBR that Windows 2000 had installed. You could still boot Windows 2000 afterwards, and you just had to find which Knowledge Base article explained the infinite loop of false assertions from NT4 setup.

  41. Cheong says:

    I think install a new boot sector is Okay, but please also check to see if other partition is bootable and add boot option to boot.ini if one is found. It’ll be lovely to also prompt for the boot option’s name if such partition is found.

    Having a "Skip" or "Next" button is good enough for inexperienced users to escape from the panic of something unknown. Windows setup will use the default behaviour in this case.

    Or prompting "An existing OS is found. Keep it?" is reasonably userfriendly. If "Yes", just label the boot option "Existing OS (1)"…

    I think it’s reasonable to not to support installation of different OS on the same partition.

  42. Pargentum says:

    Sounds like lame excuse to me. :)

    It is very simple to ask a standard boot sector to boot Windows: mark the partition active. If user has non-standard bootmanager, it might be not enough, but:

    1. Users with non-standard bootmanagers are very likely to know what they’re doing, know what happens (why Windows won’t boot) and know how to add new partition.

    2. Users with non-standard bootmanager are people who definitely will be angry if new OS would blindly overwrite their bootmanager with all its configuration and stuff.

    3. There not that many non-standard bootmanagers around there. You people do giant job of ensuring OS compatibility with thousands of applications and you seriously tell us that you cannot work your setup program around a dozen of bootmanagers?????

    Come on, practically non-Microsoft OS installers have option to overwrite boot sector or not overwrite it. Usually in same dialog where user partitions HDD. Microsoft OS do not. I do not see a reason except a pure arrogance. It does not even make sence from marketing perspective, it looks like pure – ahh, he dares to run non-Microsoft stuff, kill him – oh, we cannot? Kill his data! Oh, he will sue us… OK, slap him, punch him, annoy him!

    May be it’s not like this decision was made, but it’s like it looks.

  43. Jules says:

    I think Cheong is on the right track here, although his way still might confuse the user. The way to solve this problem is:

    1. During installation, if there is an old, unrecognised MBR, copy it to a standard filename (e.g. "OLDMBR.BIN") before overwriting it.

    2. Extend NTLDR with a way to add an option to BOOT.INI that allows you to boot from the old MBR file. This would be similar to the current mechanism used to boot Win9x, except I think it would need to load the MBR at a different address (?) and may have to patch updates from the partition table into it before execution. Document it in the knowledge base.

    At this point, as anyone trying to set up dual booting is likely to either (1) be an expert or (2) have a document in front of them explaining how to do it, it will be a simple matter for them to edit BOOT.INI and set up the necessary options.

    Setup now works flawlessly, without making other systems unbootable, and without confusing users who aren’t trying to do something complex.

  44. Pargentum says:

    Re: Jules

    Copying an old MBR to file sounds like a bad idea. If old MBR is a bootmanager, it probably has it’s own configuration tool, right? Some bootmanagers (SystemCommander comes to mind) store it’s configuration in the MBR too. So, user launches SystemCommander menu and… In best case configuration not accessible, in worst case he corrupts Windows MBR.

    However, turning NTLDR+boot.ini into a functional bootmanager (suggested by other users) able to boot non-Windows and non-DOS partitions sounds like a good idea. Actually, it should be simple: NTLDR interprets boot.ini in real mode, right? So if it is asked to boot a non-dos partition, it just loads the partition bootsector and starts it like standard MBR does. Every freaking boot virus writer can implement this in couple of hours.

    I’ll bet Microsoft will never do this…

  45. Marthinus Swart says:

    I have to agree with Raymond, to add extra complexity to the Windows installer just for the sake of a few people wanting to install more than one OS on their machines does not make sense.

    In the older days it might have made sense but with software like VirtualPC and VMWare it definitely does not make sense to create a dual boot environment anymore. I am a software developer and use multiple operating systems daily, but I use VMWare to test my multi platform applications, but I develop using my Windows XP platform.

    Secondly all my VARs installing my software either installs the Windows or Linux/Unix variant of the software on a machine and never both on the same machine.

    Also a dual boot does not allow you to have both the operating environments up and running at the same time to share files etc. between the two environments. Using VMWare or VirtualPC is much more productive when testing different applications on different platforms.

    Maybe I am missing something but a multi boot environment is not the most productive environment for cross platform development anymore. And justifying a multi boot environment with arguments like “experimentation”, “spare time research” etc. definitely does not justify a power user interface in the Windows installer.

  46. Andreas Häber says:

    Marthinus: You miss the scenario I’ve described above. Some student which use MS Office for writing reports and most of the work, but then is required to use some special UNIX-based tool for some class. Now:

    1) VMWare costs money (AFAIK)

    2) A second computer to run some *NIX costs money

    and virtualization software usually doesn’t, AFAIK, support computer graphics hardware very well. Therefore the cheapest (and could be easiest too) is to dual-boot.

  47. anon says:

    Why dual boot (and not VM)? Two words:

    Driver development!

  48. CornedBee says:

    The result: You just installed an operating system and have no way to run it.

    If I’m confident enough in my computer knowledge to set up dual boot, then you can expect me to know how to launch Windows.

  49. Purplet [italy] says:

    Why dual boot (and not VM)? One word:

    Games.

    I wonder if this scenario will improve when MacOS X will run on Apple’s x86 computers..

  50. Raymond II says:

    The good ‘ol "let the minority suffer", eh?

    Just as long as the documentation stops hiding this information I really don’t think this is an issue at all.

  51. valters says:

    Oh come on, If there was such option, I would easily figure out how to make Windows boot from my LILO or GRUB, or any other real boot loader I might happen to have.

    Also there is issue that Windows does not understand that I might set up BIOS to actually boot from 3rd SATA disk, and not from 1st IDE (master) as you may guess. I think Windows stubbornly writes it’s boot sector to… primary IDE master drive, and that’s that. It won’t even install, if it does not recognize partition scheme on that disk because "you could not possibly boot" – wrong. New bioses give us a lot of power determining how we do boot.

  52. Carlos says:

    Andreas Häber wrote:

    "1) VMWare costs money (AFAIK)"

    You can download VMware Player for free, and you can choose from a selection of pre-installed Linux images to download. In my experience it works really well. (I don’t work for VMware!)

  53. Mike Jones says:

    Why does Windows setup lay down a new boot sector? That’s easy… because it wants to literally obliterate the competition. This action should be outlawed.

  54. Gabe says:

    I would think that anybody smart enough to know how to install and configure boot loaders would also be smart enough to know that a Windows install overwrites the MBR and requires special care. The steps to adding Windows to a multi-boot setup are:

    1. backup boot loader and config

    2. install Windows

    3. restore boot loader

    4. update config to include new Windows install

    Anybody who’s too lazy or forgetful to backup and restore their custom boot loader could just as easily be too lazy or forgetful to exercise that special option in the Windows install program.

    So what’s the big deal here?

    BTW, I should mention that the old ARC standard which had the boot loader in firmware was pretty lame because it could only store settings for 3 OSes at once. I don’t know how Itanium’s EFI handles this.

  55. Dave Behnke says:

    I believe you can use "fdisk" to write a new MBR.

    >fdisk /mbr

  56. Jim T says:

    <snip>

    Even if Windows Setup did give you the option of "don’t overwrite the boot sector" you still

    wouldn’t like it.

    </snip>

    Actually, I *would* like it.

    Look, if 99.99% of windows users go down the Computer=Appliance route, why does windows ask where it should be installed to? Why not always install into the active partition, or the whole disk rather than ask this question. It would certainly be simpler. After all, 99.99% of people wouldn’t change their active partition, or even split their drive into partitions. You wouldn’t loose users data files unless you format the disk, and since Computer=Appliance, you wouldn’t want to give them that option.

    Perhaps if you detect a known previous windows version and you have an upgrade licence on the CD, you can upgrade the existing system instead.

    Since it is asking where to install it, it is assuming that we *might* be doing something more advanced, like format an existing partition or sitting next to another OS. If we’re making that assumption, the option to not install the windows boot mbr is as necessary as the other options. The fact that its missing is nearly criminal. It’s one of those things that causes pain for anyone installing >1 OS.

    So if I’m ricing on my machine and installing the 20th version of windows, after already installing the 12th linux, beos & solaris, I’m pretty happy to untick the box which says: "Install windows bootsector (recommended)" and separately, tell *my* uber-bootloader to go load windows.

    I’m happier with that than coming to the realisation that suddenly I can *only* boot this new OS. That it’s taken over the world and now I have to go digging around for a boot disk with the right version of my bootloader on it to re-install the MBR, or restore the backup – if I can find it and if I remembered to make one. And that’s if I have a bootdisk for this thing which I installed 3 years ago and have forgotten about because it just works. All because windows doesn’t come with this switch or even the ability to even restore the MBR it overwrote.

  57. The most logical choice is often the most overlooked.

    Why does Windows behave this way? Because Microsoft says it can. End of discussion. It’s a trite thing to say but it may not be far from the truth.

    Practically every other OS (not developed by MS) behaves exactly the opposite. Maybe they care about things like this, maybe their target audience is ubergeek. I know I couldn’t get my mom to install Windows, much less figure out Linux so I won’t even go there.

    Vista’s setup in even the Beta 1 does a better job at answering a lot of these questions. Yes XP and 2K do it "wrong" but Vista is on the more right path. The setup is easier, there’s not really anything confusing and it all just works. Hopefully by the time it RTMs the setup process will be more defined answering a lot more of these issues.

    In the end it is Microsoft and it is their OS. If they don’t want to play nice with others, it’s their right as a development company. Don’t like it? There’s alternatives. It’s not illegal, it’s called capitalism. You have the power to choose, the problem is you just don’t want to. Is that Microsoft’s fault? Nope. You want something better? Build a better OS that caters to the typical computer == appliance crowd and finally take the Desktop back from MS. It can happen, the problem is no one is actively TRYING to do anything about it. Linux is slowly getting there. In the years since I first played with it in ’97, it’s inched along slowly. Perhaps in another 7-8 years they’ll have something that isn’t incredibly complex for your mother to figure out. The problem is they haven’t yet chose who is more important, the ubergeek developer or those who just use the computer as a tool.

    MS is listening to customers and making improvements. Will they do anything to play nice with the competition? Hell no. It’s not good business to do that, whether your Apple, Google, or MS. I once thought that by contributing to the Windows OS you could make it "better" but only recently did I realize it’s not the developers making the decisions, it’s the managers. You want to make Windows better? Find ways to bulk up the competition to keep MS on their game. The symptom of the IE stagnation was only a symptom of the underlying root cause: no real competition. So bring it. Once you do, MS will have no choice but to call or fold.

  58. Ross Bemrose says:

    "I believe you can use "fdisk" to write a new MBR.

    >fdisk /mbr"

    Windows XP doesn’t come with fdisk installed. You need either:

    1) A DOS bootdisk, which XP can create.

    2) The Recovery Console installed, which has the fixboot command.

  59. dhiren says:

    Ross, if your MBR was overwritten such that you need to "fdisk /mbr" it to get windows to boot again, your only options to do this are the DOS bootdisk or the recovery console, since you can’t actually boot into Windows to run it.

    Personally, I think the idea of having Setup overwrite the MBR with its own boot loader, and having to search all partitions for bootable boot-sectors and adding them to Windows’ boot list automatically is the best solution. This is much easier than trying to inject Windows into an existing boot loader. Also, it should be possible to determine the OS type that resides on the partition somehow, so that the boot loader displays somewhat logical entries in its list, kinda like

    – Windows XP Professional

    – Linux

    – BSD

    I don’t think anyone with a multi-boot system would particularly care much that Microsoft didnt properly identify their particular flavour of alternate OS, and if more than one bootable partitions of the same type were found, they could just be named something like ‘Linux 1’, ‘Linux 2’, etc. It would just take one reboot for each entry to figure out which entry represented which alternate OS installation, and then users who cared enough could just edit boot.ini and rename the entries to something more descriptive.

  60. Stephen Jones says:

    A much more annoying matter is the fact that no version of Windows offers you the possibility of installing your Documents and Settings in a separate partition when you install for the first time. Instead you have to edit the register manually, and hope you have found all the right keys.

    Win 2000 allowed you to do this from an unattended install using switches, but there are plenty of non-power uses who simply want to do this on one individual machine, in order to make backups easier.

  61. Pargentum says:

    Re: Gabe

    >The steps to adding Windows to a multi-boot setup are:

    >1. backup boot loader and config

    >2. install Windows

    >3. restore boot loader

    >4. update config to include new Windows install

    You forgot step 2.5 – find a rescue disk of your other operating system. With all required drivers, probably on floppies or on Internet…

    Because, AFAIK, there is no tool to restore a MBR in a standard Windows distribution.

    Compare this to installing any other OS:

    1. Backup boot loader (just in case)

    2. Install OS

    3. Update config

    Also remember that typical Windows workstation needs clean reinstall much more often than most other PC OS. :) (and when we’re talking about multiboot we definitely are talking about a workstation).

    Whether it is a big deal or not – it depends on your perspective. It can be comparable to Windows installation in terms of [lost] worktime – I mean, finding all these disks with SATA drivers and stuff. And it is very annoying. And most annoying that it is done deliberately and without a good reason.

    Note: Microsoft is, probably, the only commercial company in the world history that can afford having pissed off and angry customers and even can afford to deliberately piss off customers for no good reason.

  62. Jules says:

    "Copying an old MBR to file sounds like a bad idea. If old MBR is a bootmanager, it probably has it’s own configuration tool, right? Some bootmanagers (SystemCommander comes to mind) store it’s configuration in the MBR too. So, user launches SystemCommander menu and… In best case configuration not accessible, in worst case he corrupts Windows MBR."

    Well, sure — at the moment (although I’ll bet nothing gets corrupted, it’s easy enough to check what you’re overwriting is what you expect). But you can bet that if Windows Setup added such a feature, all the boot managers would be updated to support it properly before that version of Windows was even released.

    "However, turning NTLDR+boot.ini into a functional bootmanager (suggested by other users) able to boot non-Windows and non-DOS partitions sounds like a good idea. Actually, it should be simple: NTLDR interprets boot.ini in real mode, right? So if it is asked to boot a non-dos partition, it just loads the partition bootsector and starts it like standard MBR does. Every freaking boot virus writer can implement this in couple of hours."

    I think this is (approximately) how it works at the moment, actually. I’m pretty sure I’ve used NTLDR to boot a custom kernel I had installed on a FAT filesystem before. The only problem is, it uses the drive letter as a way of specifying the partition, so if your partition isn’t formatted with either FAT or NTFS, you’re out of luck.

    "AFAIK, there is no tool to restore a MBR in a standard Windows distribution."

    Only because you missed step 2.1: install Cygwin.

    "Personally, I think the idea of having Setup overwrite the MBR with its own boot loader, and having to search all partitions for bootable boot-sectors and adding them to Windows’ boot list automatically is the best solution."

    The problem with this is, how do you recognise a bootable partition? Yes, it has to have 0x55AA at the end of its boot sector, but just having this doesn’t mean it is bootable. Most FAT filesystems have this code attached to a boot sector that just prints a message telling you that there isn’t an OS installed. I suspect other systems have taken this approach, too.

  63. byron says:

    "A much more annoying matter is the fact that no version of Windows offers you the possibility of installing your Documents and Settings in a separate partition when you install for the first time. Instead you have to edit the register manually, and hope you have found all the right keys."

    http://support.microsoft.com/kb/q236621/

  64. Stephen Jones says:

    Just as I said; you have to use switches with an unattended install. Hardly the same as having the option open when you do a normal install.

    And if you wait until afterwards it gets worse. This quote will give you some idea:

    —-"Replace the value data or rename the value or registry key to the new path for each and every registry key and value that contains the original path.NOTE: You must complete this change for every instance in the registry or your computer may not start. It is imperative that you update all registry keys and values with the new path."—–

  65. yonatan says:

    Well, I guess the proper thing to do is to extend the multiboot specification (http://www.gnu.org/software/grub/manual/multiboot/) to allow OS installers to detect and register themselves with existing bootloaders.

    AFAICT there’s no easy way to go about it right now, because the current spec (like most open-source stuff) is written by hackers for hackers, and doesn’t really take into account users who have no idea what an MBR is.

    Technically, it shouldn’t be too complicated. You think anyone at MS would be interested?

  66. Bryan says:

    I’m with those who say a copy of the MBR should be made. It’s sensible and easy to accomplish. Oh, we’ll also need a tool for restoring that copy, but that seems easy too.

    Personally, I gave up dualbooting long ago. Virtualized OS’s are The Way To Go in my opinion. But there are still a lot of people who dualboot, and I see them asking for help every single day. Throw them a bone, and take away one more reason some folks dislike MS!

    Does anyone know of a truly authoritative FAQ or HOWTO for multi-booting?

  67. BryanK says:

    There’s a basic misunderstanding that a lot of people seem to have here. There’s a difference between the boot sector (first 512 bytes of the OS’s partition) and the master boot record (first 512 bytes of the disk that the BIOS boots to).

    We could fix (almost) all these problems by just following this rule:

    ONLY USE THE “STANDARD” MBR CODE.

    The “standard” MBR code (the stuff that “fdisk /mbr” installs) just iterates through each partition in the partition table, looking at that partition’s “active” flag. If the partition is marked active in the table, then the MBR code loads the first sector of that partition (the boot sector), and executes the code that it finds there. Presumably this bit of code is either grub’s stage1, lilo’s image, ntldr, msdos.sys, or whatever else, which can load and execute the target OS’s kernel.

    Almost all the problems are solved: Any OS can overwrite the code stored in the MBR any time it wants to (assuming it keeps the partition table bytes intact, but that’s only 64 or 66 bytes IIRC), as long as it overwrites it with the “standard” code. Any OS can overwrite its own boot sector at will (e.g., when you change lilo’s config and have to rewrite its boot sector so that it sees the changes), because the active bit is what causes a particular bootloader to run. OSes can change partitions’ active bits, but there’s MUCH less “the MBR got corrupted” reason to do that — probably the only reason to do it at all would be if you’re intentionally trying to be anti-competitive.

    One “problem” that isn’t solved is that after installing one particular OS, it may not boot immediately. But if you’re already dual-booting, then you already use a bootloader of some sort, so you would be expected to know how to modify that bootloader’s configuration to load the new OS. If you aren’t dual-booting, then there will only be one partition — so $vendor/$distributor, feel free to set the active bit for your partition in the partition table in that case.

    (This has actually been the recommended config for quite a long time with most Linux bootloaders — leave your MBR intact, and install the bootloader into the first sector of your Linux partition. Then set that partition active, so the MBR code runs the Linux bootloader. The Linux bootloader can then chainload back to the Windows (or Solaris, or whatever) bootloader if that menu item is chosen.)

    IMO, it basically comes down to the following tradeoff: In the case of >1 partition, is it worse to (1) *possibly* not be able to immediately boot the OS you just installed, or (2) *definitely* not be able to boot the other OSes that already exist (without a rescue CD, repair mode, etc.)? (Because if you’re installing Windows at all, you very likely had it installed before, so your preferred bootloader is probably already set up to boot it from the previous installation.)

    And I’d like to second the notion that only already-technical people (re)install Windows. Basically everyone just gets it preinstalled by Dell (or whoever), and the VAST majority of people don’t change (reinstall, upgrade, etc.) the OS until they junk the computer. (Heck, half of them don’t even patch it unless forced by automatic updates!) The argument “the user won’t read or understand the message” is therefore a(nother) red herring — most of the people that use the installer will, because the fact that they’re doing the (re)install means that they’re already not the standard home user.

    [Response. -Raymond]
  68. Norman Diamond says:

    Monday, December 26, 2005 9:38 PM by BryanK

    > We could fix (almost) all these problems by

    > just following this rule:

    > ONLY USE THE "STANDARD" MBR CODE.

    There are still a nontrivial number of machines dating from say 1997 or 1998 where it’s perfectly reasonable to install a hard drive larger than 8GB but a nonstandard MBR has to be booted in order to access most of the drive. (If the machine will only be used with the NT series or Linux etc., then the user can partition and install carefully so that early boot stages will only need to access the first 8GB. But if the user only wants to use the Windows 95 or 98 that they had to pay for when buying the machine, they need to boot the drive vendor’s overlay MBR.)

    > And I’d like to second the notion that only

    > already-technical people (re)install Windows.

    Here’s a big exception. I don’t know how common it is, but it’s big. There’s a boot sector virus which I think is called WYX or something like that, and it can run and infect boot sectors even while Windows XP is up and running. A friend got hit by it. He found instructions on the web to make a Windows ME boot floppy and run FDISK /MBR, but the virus still prevented booting. I tried to explain to him why he shouldn’t use a Windows ME boot floppy when the PC only has NTFS partitions and only has Windows XP installed — and it turned out I was wrong. I ran the emergency console and tried both FIXBOOT and FIXMBR but the virus still prevented booting. The only fix was to delete all partitions and reinstall from scratch. He was hoping my technical expertise could have done a nondestructive fix, but otherwise he could have done a reinstall himself.

    By the way, being already-technical doesn’t mean being already Windows experts or already PC BIOS experts.

  69. Aaron A Aardvark says:

    You can get rid of boot sector viruses by using a free trial of some antivirus product, which you could find in a couple of minutes by Googling for "WYX".

    I use the CA one myself, but there are others. Re-installing is overkill, especially for people that actually *use* their computers for something other than installing interesting OS’s since they tend to have a lot of stuff installed that they don’t necessarily know how to install again. Back in the Windows ME days, I used to reinstall pretty regularly when I upgraded drives or installed something which killed the machine, but it’s unnecessary these days. You can use Ghost to zap the data across. If you screw the machine up, you can always use System Recovery to get back to a usable config, usually without needing to reinstall anything.

  70. BryanK says:

    Norman — if you ran fdisk /mbr, and the virus was still there, then the virus was *not* infecting the MBR. Either that, or your fdisk was broken.

    Or, after looking at Symantec’s description, the issue was probably that the timer tick interrupt happened. That virus loads into that interrupt (in DOS anyway) and re-infects any uninfected floppy or hard disk every time the timer ticks. fdisk /mbr did fix it, but 55.4 ms later, the disk got reinfected.

    To fix it, you’d have to clean out the timer interrupt first, then run fdisk /mbr, then reboot. Or just run a virus cleaner program (that virus is from approx. 2002, so it’s in everything by now).

    Regarding the 8GB limit — yes, that’s a reason to not use the standard MBR. But then, Windows will destroy that already, whenever its installer runs.

  71. David Walker says:

    Regarding marking partitions active: I wanted to swap the order of two physical disks, in conjunction with some other stuff I was doing, and I needed to mark a partition "not active" (or "unmark" the partition active). I couldn’t find a way to do this!

    Is there a way to turn off a partition’s active flag? Marking a different partition active with Disk Management doesn’t turn off the flag on other partitions.

  72. Zak says:

    I frequently deal with dual-boot Windows/Linux machines. I do not want the WinXP bootloader in the MBR; I want Grub. I want the WinXP bootloader in the WinXP partition. All[0] Linux installers ask if you want to install the bootloader, and where you want to put it. The user-friendly ones give you strongly recommended defaults; I’ve had several home users reinstall Linux (usually Mandrake), and none have ever called to ask me about the boot loader. I’ve had a couple dual-booters call me to ask why they can’t boot Linux anymore after they reinstall Windows though, and when I tell them it usually has a negative impact on their feelings toward Microsoft.

    [0]I’m sure someone can find an exception, but I haven’t seen one yet.

  73. Many OEMs ship with recovery partitions.

Comments are closed.


*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index