LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Dual boot with 2 separate hard drives and OS (https://www.linuxquestions.org/questions/linux-newbie-8/dual-boot-with-2-separate-hard-drives-and-os-264721/)

lfierro 12-09-2004 11:22 PM

Dual boot with 2 separate hard drives and OS
 
Is it possible for the PC to ask me which hard drive to boot from...

I have one HD with Windows XP and a totally separate one with SUSE Linux 9.2. So far, every time I want to use Linux, I have to open up the case and plug the HD with the Linux OS and unplug the HD with the Windows XP.

The Windows XP HD is in NTFS and would prefer not load Linux in it, and keep each OS in separate drives. Is it possible for the PC to ask me which hard drive to boot from ??

I have an ASUS A7N8X-E motherboard.

reddazz 12-10-2004 12:16 AM

You need to install a bootloader like GRUB or LILO. If you have a bootloader installed, you have the option to boot into different operating systems when your system boots up.

What I suggest you do is connect all your hard drives, let the drive with windows be the master. Rerun the Suse installation and select /dev/hdb as the hard drive for your installation (make sure you don't choose the one with Windows because you may lose all your data). Proceed with the installation as normal but make sure you select the option to install a bootloader on your mbr (master boot record). Suse detects your windows installation and adds it to your bootloaders menu, so when you boot up your system you will have the option to log into Windows or Linux.

gd2shoe 12-10-2004 12:54 AM

I wouldn't reinstall if I didn't have to. There are other ways to do it. Normally, I would put the Windows disk as master and install the boot loader to the mbr of that drive. At your point, it may be easier to go the other way, like I did.

I was given my computer as a hand-me-down (PIII450), so it already had Windows. I purchased another drive and put SuSE on it. SuSE automatically created an option for Windows in the menu.lst file (the boot menu), but Windows doesn't like to boot off the second hard drive. That is a large reason why Windows is usually put on the primary drive. Luckily, tricking Windows into thinking that it is the primary drive is not hard.

Install the Linux drive as master and the Windows drive as slave. Go to the menu (green lizard)-> System-> YaST-> Type your root password-> System (inside YaST)-> Boot Loader Configuration. From here you can mess with boot menu options, default operation system, etc. Click on "Available Selections" to highlight it, and then the "Edit" button.

Here you can see the list of choices you are given when you boot up. You want to add one for windows, so click "Add". It will ask you if you want to clone such-and-such, just say no. Now you will be given a list of options. Each option is a line in the /boot/grub/menu.lst file. Click on "Section Name" and "Edit". The 'Name' is just what shows up in the boot menu. You can put any thing in here you want. I would put "Windows XP" or something. Next, change Section Type to "other" (click on it and then edit).

The rest of the section should look like this:

root (hd1,0)
map (hd0)(hd1)
map (hd1)(hd0)
chainloader +1

The map commands are important. These are what trick windows momentarily into thinking that it is the master drive. By the time windows figures out that it's not, it no longer cares. You will need to add the map commands and use the buttons to the right to move them up and down. Just click OK a few times, and you're done.


Alternately, you can just edit the /boot/grub/menu.lst file yourself. Add the following:


title Windows XP
root (hd1,0)
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1


Post back here if you have any problems or confusion. Good luck, and welcome to LQ.

rhoekstra 12-10-2004 12:55 AM

As far as my knowledge goes, it doesn't work with LILO, as LILO does not support cross-disk-booting, eg. you can only boot from the same HD LILO is run off.

GRUB is more intelligent and might be capable to do so.

I indeed recommend WinXP as primary disk, as M$ OSes mostly don't like being run from a second disk. SuSE otoh should (probably) be reinstalled like reddazz says.. this way it will know where to find the root file system and stuff.. possible configuration mismatches are prevented tihs way

gd2shoe 12-10-2004 12:58 AM

PS. GRUB has an unusual way of naming drives and partitions. In the above example (which I think fits your description):

(hd0) is the primary master
(hd1) is the primary slave
(hd1,0) is the first partition of the primary slave.

Normally in linux these are named:
/dev/hda
/dev/hdb
/dev/hdb1

gd2shoe 12-10-2004 01:51 AM

lfierro: You can safely ignore rhoekstra's post. If you look at the timestamp, you can tell that he posted at the same time that I did. He didn't have a chance to read my post. I'll respond to his post anyway, for clarity.

GRUB can do so, it does on my system. I didn't know that lilo had that limitation. "As far as my knowledge goes" - means that I will need to research this if I ever intend to try it with LILO.

Windows doesn't like being the second disk. Refer to the "map" command in my previous post.

If you wanted to make SuSE the primary slave instead, there are ways to do this without reinstalling. Reinstalling would be easier than that, but take longer. Making the SuSE drive slave would involve editing /boot/grub/menu.lst, editing /etc/fstab, and probably involve reinstalling GRUB stage 1. Edit: These would also probably need to be done from a live CD like knoppix

My opinion, installing SuSE as master and Windows a slave will be easiest from where you're at.

rhoekstra 12-10-2004 02:29 AM

Thanks for the clarification gd2shoe ;)

I indeed hadn't read your response...

Reading it afterwards... i can concur with the solution you provide.. the 'map' commands show the true power of GRUB.
As for the 'as far as my knowledge goes' line, it had this limitation when I worked with it. But as soon as GRUB became available I dropped LILO immediately, because of its power to (un)hide partitions before proceeding (and, in this case, mapping). So I haven't kept up with possible enhancements of LILO afterwards.

Good luck, Ifierro.

lfierro 12-11-2004 10:22 AM

One small detail I had not mentioned: my two hard drives are both SATA, with no physical option for setting them as either master or slave.

I plugged both hard drives to the mother board and re-installed SUSE 9.2 professional. GRUP started up automatically, made a partition on the hard drive that had windows XP (no questions asked) , and now I have the option of selecting which operating system to start with. Its great !!! But.......here is the BUT: the second hard drive, which originally had the Linux SUSE is not being used at all.....
What happened was on my re-install SUSE Linux installed itself on the same hard drive that Windows XP was on. No data was lost, and everything works O.K in both the Linux and the Windows environment....thought the drive is much smaller with both OPs installed, and I now have a spare hard drive with no use....

gd2shoe 12-11-2004 02:37 PM

That's not cool. I'm sorry that you need to put up with the hassle. SuSE does ask where you want to install to, it just does it passively. When YaST starts, you are given a whole list of options to look at: system hardware, software to be installed, etc. One of the first options in the list the install location. YaST guesses at where to install SuSE. In this case it sounds as though it guessed wrong, and you didn't tell it otherwise.

Look in /boot/grub/menu.lst to learn how it refers to your SATA drives. I'm guessing that they will still be called (hd0) and (hd1). They may use different numbers. One of your drives may not get mentioned.

Then swap the drive cables to make the other drive bootable. Remember, GRUB will now treat the drives as though they switched names. Boot into your original SuSE install (unless you have some other problem with it). Edit the /boot/grub/menu.lst
on this drive. Add the following lines:

title Windows XP
root (hd1,0)
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

You can also do this from YaST as I explained above. This will tell grub to boot whatever is in the first partition of the second drive, and make it think that it is booting from the first hard disk. It the drive designations that you saw one the other drive are different then alter the above accordingly. if you saw it say (hd5,0) earlier, then use 5 and 6 for example.

If you run into difficulties, post here again. Alternately, you can either live with what you have and format the other drive (I wouldn't, but you can), or you can reinstall SuSE again. Just make sure that you tell YaST to install where you want it, not just to where it guesses.


All times are GMT -5. The time now is 12:11 AM.