Dual Boot Linux
Dual Boot Linux
Dual Boot Linux
GRUB HOWTO
Your machine already has Windows installed, and you are installing Linux as a
second operating system, and
You want to leave the Windows boot loader (NTLDR) on the MBR (Master Boot
Record). This allows you to continue to boot Windows with no issues. I've heard
that Windows 2000/Windows XP or anti-virus software may complain if the
MBR does not contain the Windows boot loader
You can use either GRUB or LILO to dual-boot Windows 2000/Windows XP and Linux.
Both functionally work fine, but from what I've read, GRUB requires less maintenance,
as LILO requires you to reinstall the boot loader (by running /sbin/lilo) every time
you rebuild the kernel or make changes to /etc/lilo.conf.
The location of the /boot partition on the hard drive is critical so that you don't get
screwed by the infamous BIOS 1024 cylinder limit. The BIOS of older systems can't
access data beyond cylinder 1024, which is ~8.5 GB. A simple way to avoid the BIOS
1024 limit is to create /boot within the first 1024 cylinders (~8.5 GB) of the hard drive.
If you have multiple hard drives (disks), /boot must be on the same hard drive
(probably the first hard drive) that has the Windows boot loader (NTLDR) on the MBR.
1. (What I did) Shrink the Windows partition such that there is 50 MB of unused
disk space at the beginning of the drive and lots of space after the Windows
partition. You can install the /boot Linux partition in this first 50 MB and avoid
any potential issues with the 1024-cylinder limit entirely.
2. Shrink the Windows partition such that it does not cross the 1024 cylinder (~8.5
GB), and install the /boot partition right after the Windows partition.
3. Use LBA (Logical Block Addressing). LBA allows you to boot beyond the 1024
cylinder. In order to use LBA, your BIOS must support it. In addition, for LILO,
you must also add a flag to enable LBA support. GRUB supports LBA "out-of-
the-box"
To non-destructively shrink the Windows partition, you can use the free software
program fips (please note that fips does not currently support NTFS partitions). Another
option is the excellent commercial product Partition Magic. It has an easy-to-use GUI.
Unfortunately, the tool that comes with Red Hat 7.2, Disk Druid, does not have the
ability to shrink existing partitions. Once you've shrunk the Windows partition, you can
use Disk Druid during the Red Hat Installation to create all the partitions you need for
Linux.
Dual-Boot Setup
Following are the steps to get dual-boot working with GRUB; I figured out how to do this
by looking at a similar procedure for LILO. I've verified that this works for Windows
2000 and Windows XP, and this should work on Windows NT (all 3 OSs use the same
booting architecture).
1. Install GRUB on the first sector of the /boot partition. DO NOT INSTALL IT
ON THE MBR!.
If you are performing the Red Hat installation, for the "Boot Loader Installation"
screen:
If you don't know which partition contains /boot, run the df command
and check the output.
oEdit /etc/grub.conf and make sure there is an entry for your version of
Windows. For reference, here is a copy of my /etc/grub.conf file.
2. Determine which partition contains the /boot partition by running the df
command. You'll see output like this:
3. Filesystem 1k-blocks Used Available Use% Mounted on
4. /dev/hda3 8665372 1639580 6585612 20% /
5. /dev/hda2 46636 5959 38269 14% /boot
6. /dev/hda6 513776 189504 324272 37% /osshare
7. none 256624 0 256624 0% /dev/shm
o Mount the floppy drive if it's not mounted (assumes /mnt/floppy exists):
mount -t msdos /dev/fd0 /mnt/floppy
o Run the following command: dd if=/dev/hda2
of=/mnt/floppy/linux.bin bs=512 count=1
Substitute the path for the if= parameter (the input file) with the
appropriate partition from the previous step. E.g., set if= to /dev/hda2.
o Mount the FAT32 partition if it's not mounted yet. If it isn't listed in the df
output, it hasn't been mounted yet. Check out steps 3a-3c for mounting a
FAT32 partition on the "Share Partitions HOWTO".
o Run the following command: dd if=/dev/hda2
of=/osshare/linux.bin bs=512 count=1
Substitute the path for the if= parameter (the input file) with the
appropriate partition from the previous step. E.g., set if= to /dev/hda2.
Substitute the path for the of= parameter (the output file) with whatever is
appropriate for your system. The example here
(of=/osshare/linux.bin) is for copying onto a FAT32 partition called
osshare.
If your C: filesystem is NTFS (not FAT32), you must edit C:\boot.ini as a user
with administrator-level privileges.
o Use Explorer:
Go to Tools->Folder Options->View and select Show hidden
files and folders and deselect Hide protected operating
system files (Recommended).
Right-click on the file, view the Properties and uncheck Read-
only. You can now edit the file.
After editing the file, restore the settings to their original state.
o Use the command-line:
Make the file writable: attrib -R -S -H C:\boot.ini.
After you've finished editing the file, put the settings back: attrib
+R +S +H C:\boot.ini
12. Reboot again. You should be able to pick either Windows or Linux. Selecting
Linux will start GRUB
Troubleshooting
When I select Linux from the boot menu, I get a frozen "GRUB" (or an "L" in the
case of LILO)
Make sure you created the linux.bin file correctly with the dd command. If you
think you ran the command correctly, the problem may be that your /boot
partition is beyond cylinder 1024 and your BIOS can't reach it. At system startup,
the Windows boot loader lists the choices from boot.ini. When you select
Linux, the boot loader then loads the 512-byte linux.bin file, and then BIOS
tries to access the /boot partition to run GRUB. Some BIOS implementations can
only address the first 1024 cylinders of a hard drive, which corresponds to ~8.5
GB. How do you fix this? Create your /boot partition before cylinder 1024; i.e.
before ~8.5 GB.
If I select Linux from the boot menu, I get an error message that says "Windows
XP could not load: The file hal.dll (windows/system32/) is missing or corrupt.
Please reinstall.
This is usually caused by an error in the boot.ini file. If you are unable to find
and fix the error, check out Kelly Theriot's page that provides various methods for
addressing the problem.
Acknowledgments
I think you should add help for users in despair that already have installed grub
on mbr ,thus loosing the their ability to boot into windows xp. Procedure for this
is ,boot from a windows start disc and do a fdisk /mbr At least then they can reach
their windows and this time doing it right
Mark Jordan: for verifying that this works on Windows XP and suggesting the
content for copy to floppy
Darryl Eaton: for introducting me to Red Hat Linux
I hope you found the content on this page useful (and accurate). Please email me with
feedback and corrections.
If you are interested in creating a translation of this page, please read the translation
policy.
Raiders run the 3-4 defense and Coryell offense and had a good 2005 draft.