[CentOS] Dual-boot with WinXP, CentOS already installed

David G. Miller dave at davenjudy.org
Thu Apr 16 18:32:46 UTC 2009


"Sorin Srbu" <sorin.srbu at orgfarm.uu.se> wrote:

> Hi all,
>
> I'd like to deploy a solution with dual-booting systems where CentOS 5.3 is 
> already installed and WinXP will be installed to a separate disk.
>
> I found 
> http://apcmag.com/how_to_dual_boot_linux_and_windows_xp_linux_installed_first.htm?page=1 
> and it seems straight forward enough, although the description is for Ubuntu.
>
> The problem as I see it, is that the how-to differs from how CentOS looks in 
> /etc/grub.conf and the boot-loader in Ubuntu with respect to making grub work 
> again after the Windows install.
>
> I found Tldp.org mentioning dual-boot plenty, but most or all articles listed 
> are using lilo as a boot-loader, which seems a bit obsolete and besides I 
> can't quite translate the instructions from lilo to grub. 8-/
>
> Basically, what would I need to change in the how-to from apcmag.com above?? 
> Thanks for any pointers.
As noted in other replies, Windows not not play well with anything 
else.  Your best bet would be to disable/remove/disconnect the drive 
with CentOS and then do the Windows install to the other drive.  Once 
Windows is installed, you can reconnect the CentOS drive and then easily 
edit grub.conf to boot Windows using the "chainloader" directive.  This 
approach will only work if there are no primary partitions on the CentOS 
drive that Windows recognizes.  Windows (just like DOS) assigns drive 
letters to partitions in drive number order starting with the primary 
partitions and then moving on to the extended partitions.  The bottom 
line is that you want the first Windows partition on the non-CentOS 
drive to get assigned drive letter C: when Windows boots.  As long as 
Windows doesn't recognize the partition type (e.g., ext3), no drive 
letter gets assigned.

The problem with suggestions to just install Windows and then either use 
another boot loader or repair the grub installation is that you are 
stuck doing that work through Windows.  My experience has been that 
Windows isn't as easy to work with for making changes to the boot loader 
and any approach that overwrites the Windows boot loader may leave you 
with Windows not being bootable.  The approach I described above leaves 
the Windows boot loader in place although you may need to edit 
C:\boot.ini to make sure it can still find Windows when both disks are 
"present."

Here is the grub.conf that I use on my laptop.  The internal drive boots 
to either CentOS or Windows while Fedora 10 and Ubuntu are on an 
external USB drive.

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,2)
#          kernel /vmlinuz-version ro root=/dev/hda6
#          initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=5
splashimage=(hd0,2)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-92.1.22.el5)
        root (hd0,2)
        kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=/ rhgb
        initrd /initrd-2.6.18-92.1.22.el5.img
title CentOS (2.6.18-92.1.18.el5)
        root (hd0,2)
        kernel /vmlinuz-2.6.18-92.1.18.el5 ro root=LABEL=/ rhgb
        initrd /initrd-2.6.18-92.1.18.el5.img
title Fedora (2.6.27.19-170.2.35.fc10.x86_64)
        root (hd1,0)
        kernel /vmlinuz-2.6.27.19-170.2.35.fc10.x86_64 ro 
root=UUID=232029fe-c524-47b4-a5d6-d45c0ce7e56b rhgb nomodeset
        initrd /initrd-2.6.27.19-170.2.35.fc10.x86_64.img
title Ubuntu (2.6.27-7 x86_64)
        root (hd1,4)
        kernel /vmlinuz-2.6.27-7-generic ro root=LABEL=uSlash
        initrd /initrd-2.6.27-7-generic
title Windoze
        rootnoverify (hd0,0)
        chainloader +1

My grub.conf points to Windows on a partition on the internal drive.  
Yours would point to Windows on the "second" drive (probably hd1).  
Likewise, your boot.ini will need to point to Windows with something like:

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP"

changing to:

multi(0)disk(0)rdisk(1)partition(1)\WINDOWS="Microsoft Windows XP"

Note the change -----^

I'm assuming your Windows disk would end up being /dev/hdb in a Linux 
world.  If your system is using SATA drives or the Windows drive would 
be something other than /dev/hdb, you may need to make some adjustments 
to what I have suggested.

Cheers,
Dave

-- 
Politics, n. Strife of interests masquerading as a contest of principles.
-- Ambrose Bierce



More information about the CentOS mailing list