Booting Linux from the NT boot loader

I have a simple way for booting Linux from the NT boot loader.

My machine has the following configuration

/dev/hda1 VFAT 1 Gig
/dev/hda5 NTFS 2 Gig
/dev/hdb1 ex2fs 500 Meg.

I initially installed Windows 95 /dev/hda1 on and then NT onto /dev/hda5 partition. I could then boot into NT or 95 using the NT boot loader.   This arrangement works just as well if you use 98 or ME instead of 95 and use 2K or XP instead of NT.

Initially I booted linux from dos using Loadlin, but I wanted an easier way. I also did not want to go killing any of my boot sectors.

Here is a list of the steps I used to set up booting Linux from the NT boot loader:

create a dummy boot sector
# dd if=/dev/zero of=/c/linux.b bs=512 count=1
should do. If you want to understand the dd command read the man page (man dd).  You then set up lilo to use this file as the boot sector. My lilo.conf looks like this:

boot=/mnt/c/linux.b # put the location of your dummy boot sector
root=/dev/hdb2 # put your root fs location here (you may not need it, but it won't hurt)
delay=10 # you can add all your regular lilo options
image=/boot/vmlinuz....
image=/boot/vmlinux.test

run lilo -v and make sure that everything worked.  Sometimes you might have to remove the linear option and add lba32.  Lilo will tell you if this is necessary. 

I have /dev/hda1 mounted on /mnt/c, so the dummy boot sector is already accessible to the NT loader. If you only have NTFS or do not wish to mount the filesystem, you can copy the file using mtools or an NTFS utility onto drive C. If you don't want to risk that, you could reboot into NT and use my explore2fs program to save the file onto drive C.

The final step is to modify the boot.ini so you can select Linux. Add the line

C:\linux.b = "LILO (Linux)"

and reboot. Everything should work. If not, don't blame me though. Make sure you know how to recover should anything go wrong.

How to install RedHat Linux

  1. Install 95/98/ME.  Don't use FAT32
  2. Install NT/2K/XP
  3. Install RedHat Linux.  RedHat insists that your /boot partition is below the 1024'th cylinder which is not strictly necessary.  I got around this by adding a spare hard disk and creating /boot at the start of that disk.
  4. During the install process, install lilo to /dev/hda7 NOT /dev/hda
  5. Make a boot disk.  Until you perform the steps above you will not be able to boot linux from the hard disk
  6. Boot linux off your floppy disk
  7. Back up the /boot partition
    # cd /
    # tar -cf /tmp/boot.tar /boo
  8. umount the /boot filesystem.
    # umount /boot
  9. If step 8 does not work then you will have to reboot to get rid of it.  Edit /etc/fstab and remove the line specifying /boot.  Then reboot linux off your floppy disk
  10. Restore the /boot files
    # cd /
    # tar -xf /tmp/boot.tar
  11. Follow the steps above to create the boot sector and configure and run LILO.