SUCCESS (How To): Dual boot using two hard drives on a Asus P4P800-E Deluxe (using Ubuntu 5.04 and Windows XP)
PROBLEM: There is a lot of ambiguous information on the internet about dual booting with this setup. The challenge stems from the nature of the GRUB bootloader and the way the BIOS on the P4P800-E Deluxe defines boot order. When booting "normally" into Windows XP, the first IDE drive (in my case, a SATA drive on the Promise 378 controller) is defined (in GRUB terms) as (hd0), with the Windows partition defined (in my case) as (hd0,1) and if you have another hard drive (in my case a PATA IDE drive), it is (hd1). However, if you boot from a linux distro installed on the 2nd hard drive, and you change the BIOS boot order to do so, then the device mappings according to GRUB. In this case, the linux drive (the PATA drive) is now (hd0) and the Windows partition is now (hd1,1). Setting up GRUB in the PATA drive will use these device mappings, so using a common dual-boot technique where one modifies the boot.ini file of Windows to point to a DOS copy of the GRUB bootloader, will not work. This fails because the file uses GRUB mappings in which (hd0) is the PATA drive, but you are booting from the first hard drive to load Windows, and therefore calling on boot.ini to load that file. The BIOS uses different mappings depending on which boot drive was considered "primary" and this can make the GRUB boot loader look for things on the wrong drives. This is a very confusing issue, and perhaps you can see why there is much ambiguity on the web about it. Here is a breakdown:
BIOS settings: Primary drive = Promise SATA, Secondary drive = PATA IDE HD
GRUB mappings: (hd0) = Promise SATA, (hd1) = PATA IDE HD
BIOS settings: Primary drive = PATA IDE HD. Secondary drive = Promise SATA
GRUB mappings: (hd0) = PATA IDE HD, (hd1) = Promise SATA
To rephrase the problem, suppose you boot in SCENARIO #2, to a linux install on the PATA HD, and use the technique described here: http://www.redlog.com/dualboot.html
, which uses "dd if=/dev/hda of=/mnt/floppy/boot.lnx bs=512 count=1" to produce a DOS copy of the GRUB bootloader installed on the PATA HD. In this case, the DOS copy of GRUB is using the GRUB mappings defined in SCENARIO #2. Therefore, booting in SCENARIO #1, and attempting to run the DOS copy of GRUB (boot.lnx) will work, but booting from GRUB into linux will fail because GRUB is looking for linux on the wrong drive. This returns "Error 17" or "Error 18", I've seen both.
You must change the "device map" and "menu.lst" in GRUB to what would be the correct mappings when booting from the Windows hard drive. You must do this before
creating the DOS file. Here is a step by step process of setting up this dual boot system.
Firstly, let's say Windows XP is on IDE0 and we want to put linux on IDE1. I'll use Ubuntu 5.04 for this example.
1)Boot from the Ubuntu install CD with your default BIOS boot order (probably something like Primary = Floppy, Secondary = CD-ROM, Third = Windows IDE0, Fourth = Linux IDE1).
2)Install Ubuntu with the desired options to IDE1. Allow GRUB to be installed to the MBR of that drive.
3)Reboot the computer, and press F8 at the "ASUS" screen to get a boot order menu. Choose the linux drive.
4)This should boot into Ubuntu using GRUB, which has automagically recognized your Windows XP partition on the other drive. Trying to select Windows XP from this menu will probably fail, because it is mapped to the wrong device.
5)Make a backup of /boot/grub/device.map like this:
sudo cp /boot/grub/device.map /boot/grub/device.map.backup
Make a backup of your linux MBR like this:
dd if=/dev/hd* of=/root/linux.mbr bs=512 count=1
(where * is the linux drive)
Make a backup of your WinXP MBR like this:
dd if=/dev/hd* of=/root/winxp.mbr bs=512 count=1
(where * is the winxp drive)
[NOTE: boot from a live CD and switch "if" and "of" to restore these backups]
6)Use your favorite text editor (as root) to change the /boot/grub/device.map file (as shown below if your first drive is a SATA IDE drive.) If your boot drive is a PATA IDE drive, use "hdb" instead of "sda". Either way, you will probably just be swapping (hd1) and (hd0) from the original version of this file.
[EDIT]Make sure /boot/grub/menu.lst has the correct drive mappings as well! You will probably need to modify all of the entries in the list of operating systems. For example, you will change many of the entries from (hd1,0) to (hd0,0). It may help to write down on a piece of paper what your BIOS will be calling the drives when you boot with the WinXP drive as 1st in the boot order, then write down what GRUB should call the drives based on your new device.map, and change your menu.lst to tell GRUB to look for each operating system in the correct places.[/EDIT]
7) Now, in the terminal, use the following command to start the GRUB console with your new device mapping:
8) In the GRUB console, make sure your new drives are set up correctly. Type:
The output will tell you what GRUB is calling your linux drive(s).
9) In the GRUB console, type:
where X,Y = the linux hard drive
10) Then type:
where X,Y = the linux hard drive.
11) Type "quit" to get back to terminal.
12) Now you've "broken" the GRUB on the MBR of your linux drive, because when you boot to that drive, your BIOS is calling it one thing, and GRUB is calling it another (thanks to the device.map file you edited). Let's make a DOS file that contains this new GRUB bootloader, which windows will run. Insert a floppy disk, and mount it. Type:
dd if=/dev/hd* of=/YOURFLOPPYDISK/boot.lnx bs=512 count=1
Where * = your linux drive
To "unbreak" the boot loader, restore your backup to the MBR as below:
dd if=/root/linux.mbr of=/dev/hd* bs=512 count=1
Where * = your linux drive.
13) Boot into windows and copy boot.lnx from the floppy to C:\ Then, follow the instructions at http://www.redlog.com/dualboot.html
to edit your boot.ini to give you an option where it will load "C:\boot.lnx" .
14) Change your normal BIOS settings so it always boots to the Windows drive. Simply select the new Linux entry from the Windows XP boot loader screen to run GRUB, then choose your preferred Linux image!
I hope this helps someone. Please post successes/failures below. Good luck.
Fisslefink at yahoo dot com