Seperate Boot for external drive and internal drive how to

Situation:

You have Windows XP installed on your computer’s internal drive, and then you installed openSUSE in an external hard drive. The installation has overwritten the booting sequence in your internal drive, and you can no long boot into Windows directly without the external drive.

Before starting, please print all of this. And take your time to do this carefully, one typo could mess it up.

Also, your BIOS boot sequence should be set as external first, then internal. (Otherwise your computer won’t be able to boot up anyway.)

Solution:

So first, boot into openSUSE, open a terminal window, switch to root (the “su -” command), and do:


grub
root (hd1,5)
setup (hd1) (hd1,5)
quit

The setup command should tell you it found grub stage1 and stage2, and should tell you it succeeded installing to (hd1), which is the USB MBR (remember, having booting from the internal, at this moment the USB is (hd1), not yet (hd0)).

Now press Alt-F2 and type this in the run dialog box:


kdesu kwrite /boot/grub/device.map

If you are using gnome, substitute “gnomesu gedit” for “kdesu kwrite”. Change what you have now which is this:


(hd0) /dev/sda
(hd1) /dev/sdb

to this; the reverse:


(hd1) /dev/sda
(hd0) /dev/sdb

And save the file. Now while still in kwrite/gedit, open /boot/grub/menu.lst. For safety, we will create a new stanza for your new boot configuration, before removing what is there now. So copy the first stanza, which should look like this:

###Don't change this comment - YaST2 identifier: Original name: linux###
title openSUSE 11.0 - 2.6.25.18-0.2
root (hd1,5)
kernel /boot/vmlinuz-2.6.25.18-0.2-pae root=/dev/disk/by-id/usb-ST910082_4A-0:0-part6 resume=/dev/sdb5 splash=silent showopts vga=0x345
initrd /boot/initrd-2.6.25.18-0.2-pae

paste it just below what you copied, being sure to allow a blank line in-between the preceding and following stanzas, and change the pasted text to this:


###Don't change this comment - YaST2 identifier: Original name: linux2###
title openSUSE 11.0 - USB Boot
root (hd0,5)
kernel /boot/vmlinuz-2.6.25.18-0.2-pae root=/dev/disk/by-id/usb-ST910082_4A-0:0-part6 resume=/dev/sdb5 splash=silent showopts vga=0x345
initrd /boot/initrd-2.6.25.18-0.2-pae

Note that lines 1,2, and 3 are changed. Now on this line near the top, change this:


gfxmenu (hd1,5)/boot/message

to this:


gfxmenu (hd0,5)/boot/message

Save the file. Close down and reboot. You should see the changed menu per above, and selecting the “11.0 USB Boot” choice should boot openSUSE.

Now reboot, and change the BIOS boot sequence to internal first, then external. What should happen now is that you should see the openSUSE menu again, but it will be a text menu instead and you’ll see an error telling you it could not find the grub graphical screen. This is because grub is still in the internal disk’s MBR pointing to that same grub menu file.

Select Windows and boot into it. Now use the FixMbr utility to reinstall the Windows MBR into the internal disk. You can download this here. Extract the content of the compressed file to C:/Document and Settings/[your user name]. Now go to Run and type in cmd. To be safe, remove the external drive first. Now type in the following


MbrFix /drive 0 driveinfo

You should get 6 lines of information about your internal drive. This will confirm that drive 0 is your internal drive. Now type in the following.


mbrfix /drive 0 fixmbr /yes

Oddly enough, you won’t actually see anything happen. Your screen may flash for 1/10 of a second, but other than that, nothing interesting. Now reboot and you should go straight into Windows. Plug the external drive in, switch the bios back to booting USB first, and you should get the openSUSE menu.

Once you have it all working you may want to clean up the /boot/grub/menu.lst file, e.g., removing the first stanza which will not work now and changing the third stanza to use the same root line as the one you changed. You also don’t need that “windows 2” stanza.

Further information for Vista users ONLY:

Now type in the following.

MbrFix /drive 0 fixmbr /yes /vista

Oddly enough, you won’t actually see anything happen. Your screen may flash for 1/10 of a second, but other than that, nothing interesting. Now reboot and you should go straight into Windows. Plug the external drive in, switch the bios back to booting USB first, and you should get the openSUSE menu.

(Note that “/vista” is added behind the code.")

Additional credits:

Thanks to Mingus725 for technical guidance that permitted the creation of this how-to.

Was informed that there is a small mistake with one of the commands. Thanks Holy_Cow.

Correction:

Select Windows and boot into it. Now use the FixMbr utility to reinstall the Windows MBR into the internal disk. You can download this here. Extract the content of the compressed file to C:/Document and Settings/[your user name]. Now go to Run and type in cmd. To be safe, remove the external drive first. Now type in the following

MbrFix /drive 0 driveinfo

You should get 6 lines of information about your internal drive. This will confirm that drive 0 is your internal drive.

(The “/” should be next to drive instead of next to MbrFix as in the first post)

Further information for Vista users ONLY:

Now type in the following.

MbrFix /drive 0 fixmbr /yes /vista

Oddly enough, you won’t actually see anything happen. Your screen may flash for 1/10 of a second, but other than that, nothing interesting. Now reboot and you should go straight into Windows. Plug the external drive in, switch the bios back to booting USB first, and you should get the openSUSE menu.

(Note that “/vista” is added behind the code.")

Just realise that I forgot to give credit to Mingus725 in the first post. Foolish me. Heck, I would say pretty much all the credit belongs to him :stuck_out_tongue:

You are a tall-walking, steely-eyed missile man. :slight_smile:

I haven’t tried this yet, but this is a common problem. Good of someone to address it.

Thanks for the update. I incorporated in your first post (hopefully correctly) what I think is the corrections you recommended. Snapperfishes, my thanks also to yourself, and to Mingus725.

This did not precisely work and I fubar’d my grub – but also got everything to work.

*(hd1,5) is user specific. Grub has a “find” command that will allow you to find the correct location. Ie. in a su konsole, “grub” for a grub prompt and then “find /boot/grub/stage1”. In my case, the location was (hd2,1).

*On my desktop, <f10> allows boot drive selection. After following the instructions, when I tried to boot the external drive, it skipped the drive and went to CDROM – where I had a CD of “SuperGrub” (which I recommend as a rescue device. HOWEVER – it won’t rescue from the mess I created on my drive(s) trying to make this work, so beware.)

*Perhaps my mistake was in the “setup” command. Don’t know, I followed the “GRUB Administration Guide”, which did not have two parameters, so I entered “setup (hd2,1).”

*I then ran the Yast “bootloader” to (theoretically) restore it to the way it had been. This only sort of worked – that is, I could boot from GRUB on the internal drive MBR, but SuperGrub couldn’t correctly figure out how to boot anymore.

*After looking at error messages I was getting in SuperGrub, I reverted device.map to original mapping and then my external USB drive would boot when selected from the BIOS <f10> menu. (So, device.map shows the drive as hd2, but it is treated as hd0 AFTER the initial steps of the boot process.)

*Linux continues to see my drive as “sdc” and not “sda”, so the whole thing is very confusing.

*Returning to the YAST bootloader, I found that vmlinuz and initrid were supposedly located at “/windows/D”. BUT THAT’S NOT WHERE THEY ARE. /windows/D would be (hd0,1) if booted from the internal drive, so the “swap” has in fact taken place during the booting process. (hd0,1) correctly identifies the location IF my external drive is identified as hd0 instead of hd2.

In fact, I wonder if the whole process could not be simplified to merely “misidentifying” the vmlinuz and initrid location in the YAST bootloader system, swapping locations per above.

Lastly, I found a free download program that works to restore the MBR to windows, that runs from a command prompt in windows – so doesn’t require a bootable CD. It’s called MBRfix. I didn’t run this until I was pretty sure I could reliably boot from the external drive without the internal drive MBR GRUB entry. (But I think the YAST install “repair” option would have saved me if things went awry.)

Hello anybody,
First of all…Iam sorry for my english, and to make it worser Iam a newby…former Ms-user.
I have a problem and I dont know how to fix it, would need help.
I have a well running OpenSuse 11.0 with KDE4.0, I really tray no to use Ms anymore, but for work isues I need it, so I took another internal drive and installed it.
For the instalation I set the drive as master and toke the Suse-drive out.
After hours of driver installing and WGA fixing I had it running. Then I set the MS-drive as slave and conected my Suse-drive as master and trayed to boot…nothing no grub worked. So I booted directly into the Suse-drive and managed to start up my Linux.I thought it may be a GRUB problem, so I get into my YAST deinstall the grub and reinstalled again…thinking that that would fixed it up…wrong…I know, I know…what an idiot. Now I have the problem when I tray to start my linux I just get into the console…and sorry Iam completly lost without a GUI…how can I fixed that up. Even if I just let run the Linux-drive alone I have no change, because I do not know how to fixe it.
Need help, dont want to have to reinstall my Linux and loos all my data.
Thanks
cwuzel

If you reinstall, you don’t have to loose your data.
The way you did all this has brought you into trouble. There’s a lot of posts and HOWTO’s about this on the forum.