Messed up partition table and Windows' partition boot sector
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
This on on hda1's windows install, and there isn't one on the hda5 windows install. If I'm reading it correctly, which I don't know that I am, it looks as if it is saying that it should boot hda3. But hda3 is an NTFS partition without an operating system on it.
I guess it must be referring to hda5, but I'm not sure how exactly it thinks of it as the 3rd partition. Perhaps since hda2 is extended it doesn't count it, so hda3 would be number 2 and hda5 number 3?
When I try to boot (hd0,0), the first install, grub doesn't give me any errors, and windows boots. The problem here is that the windows install that boots up isn't at (hd0,0). It doesn't boot hda1. What boots up when I tell grub to boot (hd0,0) is the second windows installation, which is on hda5.
This probably indicates your boot.ini file on /dev/hda1 (a.k.a. "(hd0,0)") has a default arcpath which is pointing to /dev/hda5. This boot.ini file was probably modified when you installed Windows up on /dev/hda5.
If I had to guess, I'd say your boot.ini arcpath to the default boot configuration looks something like this:
and you want it to look like this:
Possibly that "partition(3)" in the example above might be "partition(2)", I don't remember the details of Microsoft's arcpath numbering, but either 2 or 3 is incorrect if you want to boot the first partition. This should be "partition(1)" to boot to the first partition. Note that we are now dealing with THREE ways of specifying disks/partitions. We have grub's (hd0,0) syntax, Linux's /dev/hda1 syntax, and Microsoft's arcpath syntax.
Chances are your boot.ini file has two arcpaths defined. One pointing to /dev/hda5 (the default boot) and the other pointing to /dev/hda1. This is the way Windows does multi-booting. Different from everybody else on the planet. An astute observer will now notice, "Hey, doesn't Micorosft's multi-booting make these two Windows installations dependent on each other (because they share a boot.ini file)?" YES IT DOES! And this will create problems if you decide to remove one of these Windows installations. Surprise! Now the OTHER one won't boot!!!
So now you decide to manually edit your boot.ini file and change things around. Sorry, not from within Windows. It's a protected file. Boot into DOS or Linux to do this editing. Luckily your boot.ini is on a FAT partition, otherwise you'd run into additional headaches trying to use NTFS from within DOS. You can edit NTFS with Linux ... due caution advised.
Back to your boot sequence. You are asking grub to boot the first partition, and it DOES. But then Microsoft multi-booting takes over. It finds that boot.ini file on the first partition and grabs the default arcpath, and continues booting to /dev/hda5 since that's what the default in boot.ini tells it to do.
When I try to boot (hd0,1), the second install, grub gives me an error that it can't find something there to boot.
Totally expected. Because (hd0,1) equates to /dev/hda2 which is an extended partition, as several have already said. You cannot boot this. You will never be able to boot this. A extended partition is a container for logical partitions, as has already been said. You can boot logical partitions. In Linux it is easy to boot one. But Windows does not like to boot logical partitions without specific configuration on your part. I recommend the following tutorial to learn the nitty-gritty of Windows booting: http://www.goodells.net/multiboot/index.htm
I'm going to change it from (hd0,1) to (hd0,4) because I think that if I tell it that that it will be able to boot the second windows install from an option that makes sense.
This is a step in the right direction. But I'm still not sure it will boot for you. It's going to go up the /dev/hda5 and start looking for a properly configured boot.ini file. You probably don't have that. Because Windows is "sharing" the boot.ini file down on /dev/hda1. I believe you will find it's also sharing some other files down there on /dev/hda1. ntdlr for one (I think that's the name of the file). The moral to this story is: "Don't delete your Windows installation on /dev/hda1. This will make your installation on /dev/hda5 non-bootable. Send your thanks to the Microsoft multi-boot design professionals."
This on on hda1's windows install, and there isn't one on the hda5 windows install.
I see you posted your boot.ini file while I was replying. No, it didn't takme THAT long to type my reply! I had broght up a reply window and then walked off to do something else, coiming back and finishing replying but failing to notice your newer post.
Anyway, you boot.ini explains it all. Exactly what I expected you'd find.
Since you're actually booted into /dev/hda5, you MAY be able to edit boot.ini on /dev/hda1 from within a running Windows. You can certainly try. MAKE A BACKUP OF BOOT.INI, and then try changing it to something like what I have below. Note I increased the "timeout" so that you have a little more time to choose which OS installation to boot.
multi(0)disk(0)rdisk(0)partition(3)\WINDOWS="New Windows on hda5" /noexecute=optin /fastdetect
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Old Windows on hda1" /noexecute=optin /fastdetect
I'm not sure about that "/noexecute=optin /fastdetect" part on the "Old Windows on hda1" line. You may need it. You may not. It may screw things up. You'll just have to play around with it and see. My knowledge of boot.ini has gone downhill over the years. Most people have probably never heard of it, much less edited it and remembered the details!
If I'm reading it correctly, which I don't know that I am, it looks as if it is saying that it should boot hda3.
No, it didn't takme THAT long to type my reply! I had broght up a reply window and then walked off to do something else, coiming back and finishing replying but failing to notice your newer post.
To whom it may concern -
Please excuse the terrible typing by this poster. Things like this happen
when too much coffee is consumed, fingers work faster than brain cells,
it's a Friday, and the typer is, well, basically stupid to start with.
Thank you -- The Management
Wow, Microsoft's way of multi-booting is disgusting (not surprisingly- it is MS).
Thanks a ton for your help, michaelk and haetig. Thanks especially for showing me what I should put in my boot.ini. I'm sitting on linux, so I can edit the file from here.
I've changed my boot.ini to what you suggested, haetig. I've also, for the hell of it, changed the entry for (hd0,1) to (hd0,4) in grub's menu.lst to see if that'll boot it, out of curiosity. Of course, I'm leaving in the entry for (hd0,0), as that's the one I'll probably be using to get at both windows installs.
Oh, I also found a boot.bkk on hda1 that has this:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=OptIn
That would be the old one, from before the new windows install changed it. Given that this has the "/fastdetect /NoExecute=OptIn" at the end of the line, I think it probably won't give me any problems with having it in the new boot.ini.
All is well and good. Using the boot.ini that haertig provided I was able to access both installs.
As for trying to have grub boot hda5, no luck. It told me: "Error 12: Invalid device requested." But I didn't really expect it to work, based on what I now know of how windows handles booting multiple installs of itself. So there's no problem there and no need for that entry on my menu.lst anymore.
As an experiment, your coud TRY manually creating an appropriate boot.ini up there on hda5, telling it to boot hda5 (you know how to do that now!) Give grub a shot at it, and I expect it will complain about something. That missing ntdlr I'd guess. Act on what it complains about (assuming it complains with enough detail). If it says "missing ntdlr", then copy ntdlr from hda1 up to hda5. And so on and so on until the damn thing finally boots independent of hda1. Or so the theory goes...
Hey, I knew how to tell grub to boot hda5 the whole time, I just didn't know to tell it to boot hda5. I didn't think the windows installer would decide to make an extended partition, and I obviously hadn't double-checked with fdisk to make sure it did what I thought it did until a while later.
I'll try playing around to make hda5 boot from grub a bit later to see what I come up with. If, no, when I make it boot hda5 on its own, I'll post what I had to do to make it so.
I would have expected a few differences in what you observed about your WIndwos #1 and Windows #2 incestual relationship.
First, when Windows #2 saw Windows #1 during Windows #2 installation, I would have expected #2 to have added itself to #1's boot.ini file. In your case, it appears #2 just replaced #1's boot.ini down there on #1's partition and took #1 totally out of the picture as far as being a selectable boot item. Now this is just the most unfriendly thing I can imagine. A normal user would think #1 was toast at this point, and that #2 was the only bootable OS. So why not format #1's partition and make use of it? That's what I'd want to do. But holy crap Batman. Now #2 won't boot anymore. Who would have known #2 had a hidden dependancy on #1's boot.ini file. Especially when the average user would think #1 was totally blown away. I'd love to hear Microsoft's thinking on how to rationalize this behavior.
Second, I would have expected #2 to notice that #1 already had a "C drive". And thus #2 would have installed itself on the next available drive, probably "D". You didn't mentioned this behavior, but I would have expected that when you previously booted into hda5 your booted OS would have actually been your D drive, and any time you looked at your C drive you would have been actually viewing the old #1 installation. Maybe not even realizing it. Holy crap Batman! You didn't mention this unfriendly behavior having happened to you, but it's what I would have expected. Maybe I'm remembering wrong about this scenerio in the Microsoft multi-boot world. But if I'm remembering correctly, it gets even worse. Say Joe-average somehow managed to determine he had incestuous C and D drives. No problem, just wipe out C and rename D to C (ignoring for the moment that pesky little boot.ini down on C-#1). Guess what? Windows will let you rename drives, EXECPT for your boot drive. So you can't rename D to C. This sounds bad, but I'm sure Microsoft had a reason for it. Imagine the hell that would break loose in your registry were the boot drive letter to change on the fly.
This is why we have Knoppix, Kanotix, Slax, etc. To referee and repair Windows when it pees all over itself.
If, no, when I make it boot hda5 on its own, I'll post what I had to do to make it so.
Be sure you check out that link I posted above (Dan Goodell's page) about multibooting. Part of what he covers is how to make Windows boot out of a logical partition. This is something that Windows does not normally like to do. Although it seems in your case, it is doing exactly this. I guess Microsoft's multi-booting scenerio at least gets this little detail correct. Anyway, Dan's tutorial is something to keep in the back of your mind. I know back when I configured Windows to boot out of a logical partition, I had to manually fire up a raw disk editor and edit the logical partition's boot record. Most people have probably never heard of a "partition boot record". You've got your "master boot record", your "partition table", your "boot code", your "partition boot record", your "boot.ini". Sheesh - almost impossible to keep it all straight in your mind. I can't say that I miss having to deal with all this Windows stuff. But this thread has been a fun refresher course back to my pre-Linux days.
No one has mentioned systems backups yet, but I'm sure you've already got the notion that some of these might be a real good idea (tm) before you embark on this little "I'll get it to boot out of hda5" adventure...
Second, I would have expected #2 to notice that #1 already had a "C drive". And thus #2 would have installed itself on the next available drive, probably "D". You didn't mentioned this behavior, but I would have expected that when you previously booted into hda5 your booted OS would have actually been your D drive, and any time you looked at your C drive you would have been actually viewing the old #1 installation. Maybe not even realizing it. Holy crap Batman! You didn't mention this unfriendly behavior having happened to you, but it's what I would have expected.
Actually, when I'm on either one the drive I'm booted to is called C. (at least it was before I changed the boot.ini, I didn't check when I booted them up to make sure they booted up). I remember saying to myself "Geeze, can't they even keep the letters consistent with two installs?"
Again, I'm not trying to exlain why it happened that way, I'm just telling you that it did.
I've been reading that page you posted about multibooting and using it as reference and I try to decide how to go about making hda5 boot. It hurts my brain a little bit but I think I'm learning quite a bit.