LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Dualboot/Grub question. Installing windows AFTER linux? (http://www.linuxquestions.org/questions/linux-software-2/dualboot-grub-question-installing-windows-after-linux-583178/)

Zaskar 09-08-2007 12:15 PM

Dualboot/Grub question. Installing windows AFTER linux?
 
Heya guys, I currently have 2 HD's in my Linux box. I recently decided that I would take the second HD and make it a windows install and buy a bigger 3rd drive to replace it (was used just as a custom named files directory)

So my questions are, what would I have to do to the Grub config on the first drive to let it have the option of showing the windows install on the second drive? Ive never done an install in this order before. Usually when doing Linux second, it automatically sees the windows install and automatically sets it into the grub config.

(Im really not experienced in working with grub, so any details/guides would be very helpfull)

Thanks guys :)

drakebasher 09-08-2007 12:39 PM

I'd physically disconnect the Linux drive before installing Windows. After the install, you should be able to boot Windows if you edit you /boot/grub/grub.conf or /boot/grub/menu.lst (you may have one or both: if both, one is a soft link to the other) by adding the following lines.

title Windows
root (hd1,0)
chainloader +1

After editing, reboot and you should see a new menu item for "Windows" or whatever you choose to say after the word "title". To learn more about GRUB, this is a good reference.

pixellany 09-08-2007 12:51 PM

Previous suggestion good---some clarification: Windows installs its bootloader to the MBR of the drive--no choice. If you install Windows on the "windows drive" with the Linux drive disconnected, then the windows drive will--for the moment--be #1. When you then reconnect the Linux drive, check the BIOS settings to be sure it is now #1 again.

Since Windows will now be #2, you will also need the "map" command in the menu.lst entry.

title Windows
root (hd1,0) (tells Grub that Windows is on the 1st partition of drive 2
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1

See also the "booting" link below.

Zaskar 09-08-2007 01:06 PM

cool did some reading on various sites in the meantime too, some say I need to put the 2 map lines above the "root" line, and most also have a "makeactive" line, whats that needed for?

thanks :D

pixellany 09-08-2007 01:45 PM

I don't think the location of the map commands is critical.

"makeactive"--I think is only required if the boot flag is not on for the Windows partition

EDIT: I have no "makeactive" in my menu.lst and my Windows partition is not marked as bootable. Now suddenly, I don't feel I know ANYTHING...:scratch:

Zaskar 09-08-2007 02:13 PM

:D another thing I dont get, it says
"root (hd1, 0)"

Which one of those says it is using the first partition? in things like fstab it depicts the partitions as 1 or 2, and never with a 0, or is the 0 counting as the drives master boot record?

If thats the case, I keep a small swap partition on the second drive at the start, so would my windows partition be (hd1, 1) now or (hd, 2) (the partition in fstab was considered 2 i think) or is it still (hd1, 0) cause it just points to the master boot record, and thats unaffected by the small swap partition at the start?

Thanks again :D

drakebasher 09-08-2007 02:46 PM

Good thing pixellany caught my mistake on the map command. Windows needs to think it's on the first drive, so if it isn't, the two 'map' entries are needed. I didn't think that the placement of the 'map' commands was critical, but in my most recent install, it was, maybe because it's an older GRUB. (That machine triple boots Slackware 8.1, Windows 3.1 and Windows 3.11 on a 486/50. I'm still working on getting it to boot Gentoo with nfs-root)

My menu.lst is this:

map (hd0) (hd1)
map (hd1) (hd0)
rootnoverify (hd1,0)
chainloader +1
makeactive
boot

Quote:

Originally Posted by Zaskar (Post 2885779)
:D another thing I dont get, it says
"root (hd1, 0)"

Which one of those says it is using the first partition? in things like fstab it depicts the partitions as 1 or 2, and never with a 0, or is the 0 counting as the drives master boot record?

That's one of the most confusing things about GRUB. GRUB counts starting from 0, so the first partition on the first drive is (hd0,0). Linux calls drives hda, hdb (or sda, sdb) and so on, but it's important to remember that those are hardwired: hdb is a slave drive on the primary IDE connector, even if you only have one drive. In contrast, GRUB counts what it sees, from where it is, so if you have 2 drives on a machine that can boot to either one, whichever one you boot to, GRUB will see as (hd0).

crash_override_me 09-08-2007 02:47 PM

root(hd1,0)
i think it means
hardisk1, 1st partition

partition starts from 0

pixellany 09-08-2007 04:12 PM

Quote:

Originally Posted by crash_override_me (Post 2885803)
root(hd1,0)
i think it means
hardisk1, 1st partition

partition starts from 0

Harddisk 2, 1st partition--grub counts everything from 0.
Assuming only one type of drive
Linux...GRUB
hda1 = hd0,0
sda1 = hd0,0
hdb2 = hd1,1
etc.......

If SATA/SCSI and PATA are mixed, it can get messier.

crash_override_me 09-09-2007 03:51 AM

Quote:

Originally Posted by pixellany (Post 2885874)
Harddisk 2, 1st partition--grub counts everything from 0.

thanx for correcting me..!!


All times are GMT -5. The time now is 08:53 AM.