How To Create A Dual-Boot Linux/Windows Laptop For Under $700

Installing Red Hat Enterprise Linux WS 3 and Windows 2000 Professional on a Dell Latitude C600 laptop.

This is another installment in my ongoing project to convert my office to an OS-agnostic environment, where it doesn’t matter if users run Macintosh, Windows, or Linux on their desktop computers. To do this, I’ve been converting 20 years’ worth of data and applications from proprietary to open formats. For example, on the data side, in January 2003, I switched from Microsoft Office to OpenOffice.org and also began converting all of my legacy MS Office data to the future-friendly OOo XML-based file formats.

In January 2004, my project had progressed to the point where it was time to try running Linux on the desktop. But since I still needed Windows for some legacy applications (most notably QuickBooks Pro 2001 and FileMaker Pro 6), I decided to create a dual-boot laptop, i.e. one that could boot in either Windows or Linux. Here’s how I did it.

First, I purchased a used Dell laptop off of Ebay for $570:

Model: Dell Latitude C600
Processor: Intel Mobile PIII 750 Mhz
Memory: 256 MB
Hard Drive: 20 GB
Display: 14.1″ (1024×768)
Optical Drive: 8x DVD ROM
Modem: 56 Kbps
Network: 10/100 MBps NIC
OS: Windows 2000 Professional

The only major feature missing from my laptop was a floppy disk drive, which makes creating a dual-boot system a little more tricky, but not impossible.

The Windows Partition

There are many ways to install Linux and Windows on a laptop. I decided to 1) install Windows first, 2) then install Linux, 3) then do whatever tweaking was necessary to make dual booting work. I also didn’t want to purchase a commercial product like the Windows program PartitionMagic, which would (admittedly) make partitioning the hard disk drive much easier.

Using my Windows 2000 (Win2K) boot disk, I created a 4 GB FAT partition, left the rest of the hard disk (16 GB) unformatted, and installed Win2K on the 4 GB FAT partition. I chose the FAT format instead of NTFS because my Linux distribution supports reading/writing FAT partitions (but not NTFS partitions) from Linux. I then rebooted to make sure that the laptop would successfully boot into Win2K, which it did. On to Linux.

The Linux Partitions

I purchased Red Hat Enterprise Linux WS 3 (RHEL3) directly from Red Hat, and since I was an early adopter of RHEL3, I got to pay $300 for the privilege. But a similar version, Red Hat Professional Workstation (which was not available when I purchased RHEL3) is available for only $90 from Staples, PC Connection, Amazon.com, and other retail outlets.

Anaconda, Red Hat’s Linux installer, starts up when you boot from the RHEL3 CD 1 and walks you through the Linux installation process. New users may be confused by the various partitioning options, but here are some basic partitioning guidelines:

  1. First, reserve some space for your Windows partition. In my case, I set aside 4 GB of the 20 GB hard disk for Win2K.
  2. Second, reserve 100 MB for the Linux boot partition.
  3. Third, reserve space for the Linux swap partition. A good rule is to double the amount of RAM and reserve that much space for the swap partition. I plan on adding up to 1 GB of RAM in this laptop, so I reserved 2 GB for the swap partition (so that I won’t have to do this again when I eventually add the additional RAM).
  4. Fourth, reserve 9 GB for the root (“/”) partition and the rest for the “/var” partition (where temporary files and other files that change frequently are stored).

The disk can only be partitioned into four physical (or “standard”) partitions, so any partitions over four will be virtual partitions (i.e. part of other physical partitions). When I got to the “Disk Partitioning Setup” screen, I selected “Manually partition with Disk Druid.” Here’s how I ended up partitioning my hard disk:

Partition Mount Point Type Size
/dev/hda1 none (yet) – will be /win vfat 4095 MB
/dev/hda2 /boot ext3 102 MB
/dev/hda3 / ext3 9750 MB
/dev/hda4 none Extended 5130 MB
/dev/hda5 /var ext3 3075 MB
/dev/hda6 none swap 2047 MB
Free none Free space 8 MB

Note that the last three are virtual partitions that are actually part of the physical /dev/hda4 partition.

The boot loader is the program that runs first when the computer starts and allows you to select and boot various operating systems. RHEL3 allows you to choose GRUB (the default) or LILO as the boot loader. I chose LILO because I like its configuration file format better than GRUB’s. When prompted by anaconda, I selected “Configure advanced boot loader options” and installed LILO on /dev/hda1 on the first sector of the boot partition (not on /dev/hda, the Master Boot Record).

Network Options

Next, I selected network options to provide some basic security. I selected the following options:

  • yes- firewall
  • yes – HTTP
  • no – FTP
  • yes – SSH
  • no – Telnet
  • yes – SMTP
  • yes – port 5900 (for VNC)
  • yes – allow all traffic from device eth0 (the built-in Ethernet adapter)

Applications

RHEL3, like all Linux distributions, comes with many applications. Since I didn’t know which I’d be needing and which I wouldn’t, I decided to install all 998 (yes, 998) packages, which only took an hour and 15 minutes. (The default selection includes 646 packages and takes 0:37 minutes.)

Dual-Booting Windows and Linux

At this point, the computer booted Windows but not Linux. My challenges included:

  • I couldn’t configure the Linux boot loader, LILO, because I couldn’t boot Linux, had no boot disk, no floppy disk drive.
  • I couldn’t configure Win2K, because I had no network drivers, and so I couldn’t connect to the Internet.

Fortunately, RHEL3 CD 1 has a “rescue mode” that allows you to boot into Linux. To boot into rescue mode, type “linux rescue” at the installation boot prompt:

boot: linux rescue

Then, to make your system the root environment, run the following commands:

% chroot /mnt/sysimage
% exit

The system reboots automatically when you exit from the shell.

I found the following information on this page by searching Google (“boot loader” linux “windows 2000” boot.ini “no floppy”). (Note, however, that there is a typo on this page: it says “root partition” but should say “/boot partition”.)

Next, run the following command:

% dd if=/dev/hda2 of=/bootsect.lnx bs=512 count=1

You should get output like this:

1+0 records in
1+0 records out

The above “dd” command (which stands for “disk dump”) copies the first 512 bytes of the Linux /boot partition onto the file /bootsect.lnx.

Assuming that Win2K is installed on the /dev/hda1 partition (as it is in my system), run the following commands:

% mkdir /win
% mount -t vfat /dev/hda1 /win
% cp /bootsect.lnx /win

Running the above three commands 1) creates the /win directory, 2) mounts the Win2K partition onto the Linux /win directory, and 3) copies the file bootsect.lnx to /win/bootsect.lnx (which equals C:\bootsect.lnx), where the Windows boot loader can recognize it as a boot option.

Next, exit Linux rescue mode and boot Win2K:

% exit

After Win2K boots, verify that bootsect.lnx is non-empty by making a copy of the file named bootsect.lnx.txt and viewing it with a text editor. If the file is non-empty, then (most likely) the “dd” command did the right thing. If the file is empty, you did something wrong.

In Win2k, as the administrator, edit the file C:\boot.ini. (You may need to change your folder settings from the Control Panel so that hidden and system files are visible.) On my system, boot.ini looked like the this:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000
Professional" /fastdetect

It’s better to move the file bootsect.lnx out of the top-level Windows directory (where it could be accidentally modified or erased) and into a directory called Linux (or the like). I moved bootsect.lnx to C:\Linux\. The final step is to add a line to boot.ini resulting in a boot.ini file that looks something like this:

[boot loader]
timeout=17
default=C:\Linux\bootsect.lnx
[operating systems]
C:\Linux\bootsect.lnx="Red Hat Enterprise Linux 3"
multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000
Professional" /fastdetect

In my final boot.ini file, the default OS is Linux.

Reboot the system and, voila, the Windows boot loader displays an option to boot Linux or Windows. Choosing Linux takes you into LILO’s interface. From LILO, you can select “DOS” to return to the Windows boot loader or select the other option(s) (usually “linux”) to boot Linux.

Multi-Booting Linux Kernels

If you don’t plan on updating your Linux kernel, skip this section.

The version of RHEL3 that I purchased comes with support, so I periodically download and install patches to the Linux kernel (all of which happens rather painlessly and automatically via the up2date program). Whenever I install a new kernel, I need to edit LILO’s configuration file and recreate the bootsect.lnx file (as above).

To date, I have installed two kernel updates, so I can boot one of three Linux kernels. The file /etc/lilo.conf looks like this:

prompt
timeout=50
default=2.4.21-9.0.1.EL
boot=/dev/hda2
map=/boot/map
install=/boot/boot.b
message=/boot/message
linear

image=/boot/vmlinuz-2.4.21-9.0.1.EL
        label=2.4.21-9.0.1.EL
        initrd=/boot/initrd-2.4.21-9.0.1.EL.img
        read-only
        append="root=LABEL=/"

image=/boot/vmlinuz-2.4.21-9.EL
        label=2.4.21-9.EL
        initrd=/boot/initrd-2.4.21-9.EL.img
        read-only
        append="root=LABEL=/"

image=/boot/vmlinuz-2.4.21-4.EL
        label=2.4.21-4.EL
        initrd=/boot/initrd-2.4.21-4.EL.img
        read-only
        append="root=LABEL=/"

other=/dev/hda1
        optional
        label=DOS

I created a small shell script (dual-bootify.sh) to automate the process of creating the bootsect.lnx file. I prefer Emacs for text editing, but if you’re not comfortable with Emacs or VI, you can create this file from the Linux command-line by entering the following commands (as root):

% cd /
% cat > dual-bootify.sh [ENTER]
dd if=/dev/hda2 of=/bootsect.lnx bs=512 count=1 [ENTER]
mount -t vfat /dev/hda1 /win [ENTER]
cp /bootsect.lnx /win [ENTER]
/sbin/lilo -v [ENTER]
[CTRL-D]

The command “cat > dual-bootify.sh” creates the new file, whatever you type next will be entered into the file, and typing [CTRL-D] closes the file. You should add the command “mount -t vfat /dev/hda1 /win” to your startup scripts (i.e. add it to the file /etc/rc.d/rc.local so that the Win2K partition is mounted automatically. You could also create a script in /etc/rc.d/init.d/ to copy the latest bootsect.lnx file to the Windows partition every time the machine shuts down, but that would be overkill, in my opinion. If you patch the kernel and forget to run dual-bootify.sh (or the equivalent commands), you will be able to boot into Windows but not Linux, and then you’ll have to boot from a floppy disk or from install CD 1 in rescue mode. So there is always a solution lurking somewhere.

Summary

This method works for the user who doesn’t have the Windows program PartitionMagic, wants to get Windows working first, and then wants to add Linux. I am aware that there are other options for creating a dual-boot system. That’s the beauty of Linux — and why I installed Linux in the first place — choices.

One Reply to “How To Create A Dual-Boot Linux/Windows Laptop For Under $700”

  1. Great historical reference piece here, well done on keeping a blog going for this long, make looking back on things really insightful. The 20 GB harddrive brings back memories

Leave a Reply

Your email address will not be published. Required fields are marked *