Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [23]

By Root 2815 0
it’s a robust program with many features. You can specify many different options when installing the boot loader, but the defaults are usually fine. For example,

# disklabel -B /dev/wd0s1

installs the default boot loader on the first partition of the first IDE disk.

This second-stage boot loader refers to the following files to obtain its configuration:

/boot/loader.conf

/boot/loader.conf.local

/boot/defaults/loader.conf

The last of these files contains the default settings for the boot loader and should never be modified—the options it specifies can be overridden in the loader.conf and loader.conf.local files, as well as on the boot loader command line at boot time. The boot(8) and loader(8) man pages provide the dirt on all the boot loader options.

Multibooting on PCs


Since many operating systems run on PCs, it is fairly common to set up a machine to be able to boot several different systems. To make this work, you need to configure a boot loader to recognize all of the different operating systems on your disks. In the next few sections, we cover some common multiboot stumbling blocks and then review example configurations for Linux and FreeBSD.

Every disk partition can have its own second-stage boot loader. However, there is only one MBR. When setting up a multiboot configuration, you must decide which boot loader is going to be the “master.” For better or worse, your choice will often be dictated by the vagaries of the operating systems involved. Linux pretty much has to be booted by LILO, so that’s generally the best MBR option for any system that has a Linux partition. The exception to this rule is Windows NT/2000, which sometimes needs to have its own boot loader in the MBR. We know of systems on which LILO can boot NT from the MBR; we also know of cases in which this just doesn’t work.

Multibooting gotchas


Installing a multiboot system can make you tear your hair out. This section is meant to prevent you from going bald.

If you’re installing a multiboot system that includes a consumer version of Windows (95, 98, or Me), always install Windows before you install anything else. The consumer versions of Windows are very stupid and have no idea that other operating systems may exist on the same machine. They will always want to take partition 1 on your first hard disk and will overwrite other boot loaders during installation.

The same rule applies to Windows NT/2000: always install Windows first. The reasons are slightly different, but the upshot is the same. The NT/2000 boot loader really, really wants to be installed in the MBR and be the One True Boot Loader for the system. Resistance is futile.

To get the NT/2000 boot loader to boot a UNIX partition, install UNIX and then boot to it using a floppy or CD-ROM. You’ll need to peel off the first 512 bytes of the UNIX partition (this is the partition boot record), and write them to a file. You can do this with the dd command. Here is an example from Linux:

# dd if=/dev/hda2 of=linux.bin bs=512 count=1

You must then copy this file to the NT/2000 partition and add an entry to the NT boot loader configuration that tells it how to boot using this file. We don’t describe the NT boot loader in this book, but all you really have to do is add a line to C:\boot.ini that contains the file’s path along with a label. For the Linux case, the line would look something like this:

C:\linux.bin="Linux"

For more information about the format of the boot.ini file, see the on-line Microsoft Knowledge Base at support.microsoft.com.

If Linux and Windows NT/2000 are cohabitating, LILO will need to be installed onto Linux’s disk partition, since the MBR is already spoken for. To do this, have the boot line in lilo.conf point to your Linux partition. For example, if Linux is on the second partition on the first IDE hard disk, the line would be

boot=/dev/hda2

You’ll need to make this change before you copy the second-stage boot loader to a file and transfer it to the NT partition. In fact, you will need to repeat the entire process whenever

Return Main Page Previous Page Next Page

®Online Book Reader