Personal tools
You are here: Home Team Members Rehan Khan Dual Booting Fedora (Windows XP already installed - ntldr method)

Dual Booting Fedora (Windows XP already installed - ntldr method)

by Rehan Khan last modified Jan 17, 2009 11:12 AM
— filed under:

This How-To will cover Installing Fedora on a Windows machine and Dual Booting Fedora from a Windows XP machine using Grub4Dos. This is a relatively simple method that is non-destructive to the Windows installation. You will need to have some un-partitioned space on your machine to follow this configuration.

Some reasons you might want to use this method:

  • You don't want to boot Windows from grub (or you don't want Grub to become your primary boot loader).
  • You want the core Windows and Linux installations to be effectively separate and un-modified/un-customised. Future upgrades on one will not effect the other (from a boot perspective).
  • You want to test (install f8/remove/install f9/remove/... ) Fedora on your Windows machine (see above!)
  • You don't want to remove the default windows installation/recovery partition from your machine so that you can still get support on the machine from the vendor.
  • You want to install Fedora on a Windows machine temporarily to:
  1. test the hardware compatibility in linux.
  2. test some new/beta linux drivers on that hardware, (say, to provide feedback to kernel devs).
  3. look for files on your windows partition that might be actively hidden by a windows rootkit (!).

 

Note : This procedure can be used with Vista but it is recommended that with Vista the EasyBCD tool is used to directly boot linux from the Vista Bootloader. See this link.

 

Warning:

This document assumes that you are able to make some unpartitioned space on a Hard disk possibly by resizing partitions. This can be a risky procedure and you can end up losing ALL your data if done incorrectly. Please consider carefully what you are doing BEFORE you do it to minimise any risks. Check, think, re-check, think and check again. Thinking about things AFTER you have done them when things have gone wrong may not get your data back and may require you to spend a significant (~days) amount of time and expense to fix (and still not get your data back). If you decide to go ahead follow this guideline depending on your confidence and experience:

 

  • New user/inexperienced/busy people/people with a healthy fear of doing silly or dangerous things/people with no backups : Use a third party tool like Gparted LiveCD (no cost) or Acronis DiskManager (costly).
  • medium experience/experienced/fearless or adventurous people/people with backups who also know how to restore thier data correctly: As above but any method you are knowledgeable about and confident with e.g Recent Linux boot cd using ntfsutils and ntfsresize, possibly the repair option of the Fedora install cd - not tested.

 

Make sure you have backed up any important data to a different disk (external/other hard drive, CD/DVD, tape). Make sure your external backup is not connected to the machine when you are resizing partitions.

 

Although it is not directly relevant to this document one should note that many Partitioning Tools are not aware of or don't work with partitions held within/inside a LVM partition. If your partitioning tool cannot show you the partitions inside the LVM volume and doesn't explicitly say it supports LVM volumes DON'T resize an LVM volume. It is data destructive usually with no easy way of going back. LVM partitions are usually designated 'unknown', 'Linux LVM' or show a partition ID of 0x8E.

 

Applicable to :

  • All recent Fedora Versions
  • Generally applicable to most Grub based Linux Distros.

Requirements

 
  • Some knowledge/understanding of disks, partitions and filesystems.
  • The primary requirement is to have some space on a drive where you can install Fedora. Usually a new Windows machine will have one main partition with the Windows OS installed. Some vendors have a configuration/recovery partition either at the beginning of the drive or more usually at the end of the drive (some both!). The unpartitioned space should be created at the end of the drive after all the existing partitions. This will usually mean that the main Windows partition will have to be shrunk. If there is a recovery partition at the end of the drive this should also be moved back to maintain the partition order (and hopefully the functionality of the recovery partition). Bear in mind that only empty unpartitioned space has to be made, there is no need to change the active partition or do anything else. Have a Windows restore disk available that definately works on your machine just in case things go horribly wrong.
  • Re-partitioning the drive is out of the scope of this document and merits a How-To of it's own. Until this is complete use the following links to work through this step.

 

        1. http://gparted.sourceforge.net/livecd.php
        2. Use non-free software like Acronis Diskmanager which can do everything using a simple gui interface within windows.
        3. http://www.nishants.net/articles/ntfsresize.htm
Please note that Windows Disk Manager cannot be used to complete this step.



Disk space requirements for free space:
  • Minimum                  : 5 to 6 Gb
  • Useful                      : 10 to 12 GB
  • More than enough   : 20 GB +
 

A copy of Grub4Dos which can be downloaded from here:

 

Doing the Work

 

1) Make available unpartitioned space on a connected Hard disk

 

2) Install Fedora to the unpartitioned space

    Before starting make absolutely sure you have made some space at the end of the drive after the windows ntfs partition and that the space is un-partitioned space. This can be checked in Windows Disk Manager.

    One of these guides can be followed to install Fedora, depending on the version you want to install : http://docs.fedoraproject.org/install-guide/

     There is only one (very important!) change to a standard install that needs to be made if you are following the guides.

     

    For example whilst installing Fedora 8:

    • On the disk partitioning screen (make no changes here), select the review and modify partitioning checkbox.
    • Click next
    • Say Yes to the dialog that asks you if you are sure you want to remove all Linux partitions.
    • On the Review and modify partitioning screen click next making no changes
    • Select the 'Configure advanced boot loader options' checkbox and click next
    • Select the radio button next to the line containing 'First sector of Boot Partition'. <-- This is very important! Very very.
    • Continue with the install until you reboot when it is finished.

     

    On Fedora 10:

    • Once the partition data has been written to disk, a boot loader configuration screen is shown.
    • Click the change device button
    • Select the "First Sector of Boot Partition" option

     

     The steps are similar in F9 and F10. The key is to not overwrite the Windows boot sector.

     

    3) Install and Configure Grub4dos in Windows

     

    a) If everything has gone smoothly you will reboot back into Windows (As the linux boot sector is on the linux partitions not the mbr or ntfs partition).

    b) From the grub4dos zip file you downloaded earlier, extract the grub4dos directory to c:\.

    c) Copy the grldr file from the c:\grub4dos directory to C:\. (The grldr file must go into the root of the c:\ drive). It is important that the grldr file should be in the c: drive that windows sees.

    d) Now edit the Windows boot.ini file. To work around windows default settings of hiding system files the boot.ini can be accessed by clicking on the START button and selecting RUN. When the run dialog pops up type "notepad c:\boot.ini" (without the quote marks). Click OK. Notepad should pop up. Add the following line to the bottom of the file:
    c:\grldr="Grub4dos"
    For example the boot ini might look like this:
    [boot loader]
    timeout=3
    default=multi(0)disk(0)rdisk(0)partition(1)\windows
    [operating systems]
    multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
    c:\grldr="Grub4dos"

    However your boot.ini file looks, the most important line is the the last one.

    Press ctrl-s to save. As the boot.ini is a system file this first save will fail. When the file dialog pops up just click on save again and the boot.ini will be saved. (strange but true)

    That should be all that is required to set things up.

    Final Configuration and Troubleshooting

    How to test


    Reboot and select Grub4dos from the windows boot menu. This will start grldr which loads Grub4dos. After a second or two Grub4dos will try to find the drive with a menu.lst. It looks in various places to cover the different flavours of linux out there. It should find the linux boot partition that was created during the Fedora installation. Grub4dos will then execute the Fedora menu.lst as if it was the Fedora Grub. The normal Fedora boot process will follow.

     

    Common problems and fixes

    1. Grub4dos probably doesn't support ext4 boot partitons yet (F10 doesn't either but F11 might). So only use ext4 for your root partition and leave the boot partition as ext2 or ext3.
    2. If Grub4dos finds the Fedora boot partition and starts the Fedora boot menu but then fails to boot Fedora then the Fedora boot menu might be looking in the wrong place for the Fedora boot partition. This is caused by the hardware looking at drives one way, grub looking at drives another way and Windows and linux looking at drives in other completely different ways. Ugly but it's like this for historical reasons. The fix is to press the 'esc' key when Grub4dos finds the Fedora boot menu, then the 'e' key on the first item in the list. The 'e' key again to edit the "root (hdx,y)" line (where x=disk number  and y=partition number) and adjust the y parameter either increasing by one or decreasing by one. Press enter to save the change and 'b' to boot. If there is more than one disk in the system then you might also have to play around with the x value. If this works, then when you have booted into Fedora edit the /boot/grub/menu.lst to make the working x,y value permanent for each line that has root hd(x,y).
    3. Once there is a working configuration in <linux boot partition>/boot/menu.lst this can be  directly transferred into c:\Grub4dos\menu.lst. The downside to this is that this will need to be manually updated each time the kernel is updated (so basically it's a working option but don't bother).
    4. The boot.ini can be requested to boot linux/Fedora by default by changing the default= line to read default= c:\grldr in the boot.ini.

    More Information

    EXT2IFS

    This  driver can be installed in Windows. It gives access to ext2 and *clean* ext3 file systems through Windows. Using this you can look into e.g the /boot partition and edit the menu.lst. Notepad++

    is a good Windows editor if you are editing files on your linux partitions as it retains linux linefeeds if the file originally contained them. Please note that using Ext2IFS, while helpful in certain situations, is a security risk so use it with care.

     

    Disclaimer

    We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #fedora on irc.freenode.net

    Added Reading

     Excellent Grub4Dos guide : http://diddy.boot-land.net/grub4dos/Grub4dos.htm

     

     

    Appendix A : Some notes about hard disk naming (very simplified)

     

    It might be helpful to keep in mind that the Bios, Grub, Windows XP and Linux all use slightly different methods to designate/label/identify their disks.

     

    Bios: The bios organises it's disk's depending on where they are connected. As a general rule by default The disks connected to the IDE interface (sometimes described as pata) are listed first. If there is an onboard sata interface any disks connected here will be listed next. Any add-on boards are listed finally. The bios designates it's disks disk0 (also sometimes called the boot disk), disk1 etc although you will not usually see this anywhere useful. Some bios' allow you to designate which disk is disk0. Disk0 is important because this is the disk that the bios will try to boot from. It must have a Master Boot Record (MBR) of some sort.

     

    Grub: Disk's are labelled (hdx) or (hdx,y) in grub where x is the disk number and y is the partition number. Both x and y start counting from 0 (zero). Grub labels hd0 by looking at what the bios has labelled disk0 and hd1 from what the bios has called disk1 etc.

     

    Windows XP : Uses a slightly more complex notation which can be seen in the boot.ini. The details are out of scope for this documentation and should not be needed.

     

    Linux: Linux generally calls the bios' boot disk /dev/hda or /dev/sda. Linux designates partitions on disks by adding a numeral after the device name and starts counting from 1 (one). e.g. bios disk0 -> linux /dev/sda -> First partition = /dev/sda1. Sometimes the file /boot/grub/mapppxxx is used to change the way linux see's and labels the bios' disks.

     

    A couple of examples:

     Disk connected to Primary IDE channel on the end connector :

    (hardware) Primary IDE Master -> (Bios) Disk0 or boot disk -> (Grub) hd0 -> (Linux) /dev/sda 

     

    Disk connected to Primary IDE channel on the end connector, with 1 partition :

    (hardware) Primary IDE Master -> (Bios) Disk0 or boot disk, active partition-> (Grub) hd0,1 -> (Linux) /dev/sda1

     

    Disk connected to onboard Sata 0 with 1 partition :

    (hardware) Sata 0 -> (Bios) Disk0 or boot disk, active partition-> (Grub) hd0,1 -> (Linux) /dev/sda1

     

    So depending where you are and what you are doing be sure to use the correct disk/partition naming convensions.

     

    Appendix B:

    Grub4Dos had an issue chainloading Fedora Grub, on my machine it hangs the machine. This might work on your machine and it would give you a more seemless boot environment. To test this add the following to the menu.lst file in c:\

     

    [code]

    title Fedora (grub boot)

    chainloader (hd0,1)+1

    rootnoverify (hd0,1)

    [/code]

     

    This will boot partition 1 on disk 0 (adjust this to point to your Fedora /boot partition). You should in theory get the Fedora  Grub boot screen.

     

    Please report back if this works for you as it is a more preferred solution.

     

    Document Actions
    Log in


    Forgot your password?
    New user?