Windows XP and Linux


Using both Windows XP and Linux on the same system is a very rewarding multiboot scenario. This gives you two very powerful operating systems that can work in harmony on the same system. Linux can be booted from any type of partition on any installed disk, be it primary or logical. This enables you to create a Linux partition anywhere you have enough space to put it.

One of the great advantages of this configuration is Linux's capability to read, and sometimes write, nearly every file system under the sun. You'll be able to share files between your two systems with a minimal amount of hassle. Be sure to see Table 31.1 (earlier in this chapter) to properly plan for file sharing between both operating systems.

NOTE

Linux can read NTFS partitions quite well. But with the current level of NTFS support, when Linux writes to an NTFS partition, it causes some repairable damage to the file system that Windows XP has to fix the next time it boots. This makes me nervous, so I'd suggest that you avoid the need to have Linux write to an NTFS disk. Install Windows XP in a FAT32 partition, or use a third FAT16 or FAT32 partition to store common files.


LILO, the Linux Loader

Just as Windows XP uses the Windows loader to select an operating system and boot up, Linux uses a boot loader as well. Linux users have several to choose from: LILOthe LInux LOader, GNU GRUB, SYSLINUX, and LOADLIN. This chapter discusses just LILO.

However, configuring LILO is beyond the scope of this book. I'll only discuss a multibooting setup that uses the Windows loader, so if you're following these instructions it's important that whatever process you use to set up your system, you end up with the Windows loader on your primary disk's Master Boot Record, rather than LILO.

There are two ways to make sure this happens:

  • If you install Linux first, and then Windows XP, the XP loader will replace LILO. Then you can use the procedure described later in this section to create a Linux boot file for the Windows loader.

  • If you install XP first, then Linux, you'll have to take care to tell the Linux installation system not put LILO on your computer's Master Boot Record (MBR). If it does, the XP loader will be overwritten. How you specify this differs from one Linux distribution to another, and may even differ between versions of the same distribution. In the instructions later in this section, I'll describe how to do this for Red Hat Linux version 7.1, but the procedure may be different for your copy of Linux. If the XP boot loader does get overwritten, you'll find out quickly: You won't get a boot choice menu. You'll have to follow the procedure under "Boot Menu Isn't Displayed" in the Troubleshooting section at the end of this chapter.

Clearly, it easiest and safest if you can install Linux first. If you can't, please read your Linux distribution's installation instructions carefully, and select an installation mode that does not automatically put LILO on the Master Boot Record. The scenario we discuss in the next section assumes that you've already installed Windows XP before installing Linux.

If you do accidentally overwrite the Windows Loader with LILO, see "Boot Menu Isn't Displayed" in the "Troubleshooting" section at the end of this chapter.



Installing Linux

This section deals with the task of installing Linux in a multiboot situation with Windows XP. Although a complete tutorial on the installation of Linux is out of the scope of this chapter, we will try to cover the essential points needed to make your system multibootable.

The procedures in this chapter assume that you are using Red Hat Linux version 7.1, but they should be similar for more recent versions and for other Linux distributions. For the purposes of this example, you will be installing Linux onto a separate partition on the same disk as your Windows XP installation. Refer to Table 31.2 to be sure you have enough free space to install both Windows XP and Linux.

TIP

If you do not have enough space in your hard drive, consider adding a second disk or using the PartitionMagic program to shrink an existing partition.


NOTE

Although the following information provides the basics for dual-booting Windows XP with Linux, you'll find much more detailed coverage in The Multi-Boot Configuration Handbook, published by Que. You should also search the Web for information about multibooting your particular version of Linux.


You can install Linux and Windows XP in either order. Just be sure to read the previous section titled "LILO, the Linux Loader." If you want to use NTFS for Windows XP, be sure to leave additional room for a FAT32 partition on which to store files you want to share between the two operating systems. Refer to Table 31.2 to find the minimum amounts of space needed. If you can, allow 3 or more GB for each partition.

Then, follow your Linux version's installation procedure. When asked to choose a boot loader, select LILO, and enable the option to create a Boot Disk (floppy).

Write down the name of the partition that contains LILO. It will be named something similar to /dev/hda1. You'll need to know this later when I discuss locating the Linux boot sector.

Getting the Linux Boot Sector

After you install Linux, you'll need to create an image or file dump of the Linux boot sector. You need this to configure the Windows XP boot loader to boot into Linux. Here's how to get it:

1.

Get a blank, formatted 1.44MB floppy disk.

2.

Shut down and reboot your computer with the Linux boot disk discussed in the previous section.

3.

When Linux has finished booting, log in as root using the password you supplied during installation. All the following steps must be performed as root.

4.

Remove the boot disk, insert the formatted MS-DOS floppy into your disk drive and type the following command:

 mount -t msdos /dev/fd0 /mnt/floppy 

This will make the disk available to you by mounting it in the directory /mnt/floppy.

TIP

If you need to format the floppy from within Linux, you may do so by typing the following command from the prompt:

 fdformat /dev/fd0; /sbin/mkfs -t msdos 

This command will give you a freshly formatted MS-DOS disk in Linux. From there you can simply mount the disk to get access to it.

5.

The next step is to write the Linux boot sector to the disk. The most important part of this step is to make sure you take the boot sector from the correct partition. This partition is the one that was installed in LILO during the Linux installation. If you're unsure which partition contains the Linux boot sector, issue the following command:

 more /etc/lilo.conf 

which will give you output similar to the following:

 boot=/dev/hda1 map=/boot/map install=/boot/boot.b prompt timeout=50 image=/boot/vmlinuz-2.4.2-2     label=linux     root=/dev/hda1     read-only 

6.

The "boot=" entry at the top of the file tells us that LILO is installed in /dev/hda1. Using the dd program, issue the following command:

 /bin/dd if=/dev/hda1 of=/mnt/floppy/bootsect.lnx bs=512 count=1 

This command will copy the Linux boot sector at /dev/hda1 to a file called bootsect.lnx on your disk.

7.

Next, unmount the floppy disk using the following command:

 umount /dev/fd0 

8.

Finally, remove the floppy disk from your computer and reboot the system:

 /sbin/reboot 

If you haven't already installed Windows XP, do this now. If you created an extra partition to use for shared file storage, you can create and it now as well.

Adding Linux to the Windows XP Boot Loader

After both Linux and Windows XP are both installed, you can add Linux to the Windows XP boot loader from any version of Windows you have installed. The steps are exactly the same and are not operating system-dependent.

1.

First, boot up Windows. Copy the bootsect.lnx file, which you created in the previous section, from your floppy disk to the root of your C: drive. This can be done from a command prompt or from the Windows Explorer. This file must be located in the root folder.

2.

Modify the BOOT.INI file to add an entry for Linux. The easiest way is to open the System control panel applet, view the Advanced tab, select Settings under Startup and Recovery, and click Edit.

3.

Next, add the following line at the end of the BOOT.INI file:

 C:\bootsect.lnx="Red Hat Linux Version xxx" 

but, of course, substituting the appropriate Linux distribution name and version number.

4.

You can now save BOOT.INI, reboot, and select the Linux option from the boot menu. It's a long and complex procedure, but that's one of the reasons we love Linux!

Mounting Windows Disks Within Linux

Next, you'll want Linux to mount your Windows disks so that you can share files between both operating systems. This will enable you to copy files back and forth without using external media such as floppy disks. All the following steps must be performed as root because they are system-sensitive procedures:

1.

First, create the directories within which you will mount the Windows file systems. The normal Linux convention is to create these directories in the /mnt tree.

2.

Issue commands to create the directories for your Windows FAT16 or FAT32 partitions:

 mkdir /mnt/windisk1 mkdir /mnt/windisk2 (etc). 

NOTE

These directory names are a matter of taste. You can use whatever name you feel comfortable with at this point. As long as these directories exist, your Windows partitions should mount easily.

3.

To test the first mount point, attempt to mount the first FAT32 partition using this command:

 mnt -t vfat /dev/hda1 /mnt/windisk1 

4.

You can examine the contents of this partition by simply executing

 ls /mnt/windisk1 

5.

If the mount was successful, you will see a familiar list of files and directories found on your first Windows partition.

6.

Likewise, you can mount an NTFS partition with the following command:

 mount -t ntfs /dev/hda2 /mnt/windisk2 

using the correct hard drive number, of course.

NOTE

By default, the NTFS file system driver is not enabled most versions of Linux. You must consult your documentation to enable this driver; that is, to have it built into the kernel or loaded at boot time. As stated previously, if you use this driver, it is recommended that you use the read-only version.


Enabling these file systems to automatically mount in Linux involves a procedure that is out of the scope of this discussion. Although it is possible, only experienced Linux users should attempt to modify the system's boot time mount parameters. Typically, the changes needed to auto-mount foreign file systems are made in /etc/fstab. Red Hat Linux includes a GUI utility, called linuxconf, that makes this task much more simple. Consult the documentation that came with your Linux distribution.



Special Edition Using Microsoft Windows XP Professional
Special Edition Using Microsoft Windows XP Professional (3rd Edition)
ISBN: 0789732807
EAN: 2147483647
Year: 2003
Pages: 450

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net