Top Five Open Source Packages for System Administratorsby Æleen Frisch, author of Essential System Administration, 3rd Edition
This is the third installment of a five-part series in which I introduce my current list of the most useful and widely applicable open source administrative tools. In general, these tools can make your job easier, no matter what Unix operating system your computers run.
Administrators who take care of Linux systems are undoubtedly familiar with the LILO boot loader. LILO (or Linux Loader) was a great tool in its time, and it enabled you to boot not only the Linux operating system, but also any other operating system that might be running on the same Intel-based PC hardware (including all of the various versions of Windows).
There is a newer, more general and flexible boot loader coming into wide usage. It is named GRUB: the GRand Unified Bootloader. It was originally written by Erich Boleyn and is now part of the GNU project. Current development is overseen and led by Gordon Matzigkeit and Okuji Yoshinori. The project's home page is http://www.gnu.org/software/grub.
The GRUB developers are very enthusiastic about their program (and rightly so), as indicated by this quote from Gordon Matzigkeit:
Some people like to acknowledge both the operating system and kernel when they talk about their computers, so they might say they use "GNU/Linux" or "GNU/Hurd." Other people seem to think that the kernel is the most important part of the system, so they like to call their GNU operating systems "Linux systems." I, personally, believe that [both are] a grave injustice, because the boot loader is the most important software of all.
[Accordingly,] I used to refer to the above systems as either "LILO" or "GRUB" systems. Unfortunately, nobody ever understood what I was talking about; now I just use the word "GNU" as a pseudonym for GRUB. So, if you ever hear people talking about their alleged "GNU" systems, remember that they are actually paying homage to the best boot loader around: GRUB!
In This Series
Number Five: Amanda
Number Four: LDAP
Number Two: Nagios
If Gordon has his way, someday all "Linux" systems, "FreeBSD" systems, and so on, will be GRUB systems. In fact, the most recent versions of Red Hat Linux and SuSE Linux install GRUB by default or offer it as an option.
I prefer GRUB to other boot loaders for the following reasons:
It is independent of the operating system or systems to be booted.
It has a simple menu interface for normal boot choices.
It can function as a complete boot time shell, providing an environment in which you can enter any boot command that you want. Alternatviely, you can choose to modify an existing menu item.
GRUB does not require you to reinstall it every time the kernel or system configuration changes.
GRUB includes the following main components:
First and second stage boot-loading programs suitable for a variety of operating system environments.
Unix utilities for installing and configuring GRUB.
The grub.conf configuration file for defining boot processes and their associated menu items.
Before we consider the process of configuring GRUB, we need to note how disks are referred to within this package. GRUB defines its own disk notation so that disk partitions and slices can be indicated, regardless of the operating system that they happen to hold. The following example shows the general disk syntax:
where n is the disk number (starting at 0), and p is the partition number (again, starting at 0). For example, the second partition on the third hard disk would be designated as:
For operating systems that further subdivide the hard-disk partition, this syntax adds a third field consisting of the (sub)partition letter within the slice (physical partition). For example, the a partition in the first slice on the first hard disk under FreeBSD would be designated as:
We're now ready to look at the GRUB configuration file (grub.conf). Here are some sample lines from its first, general section:
# general section splashimage (hd0,0)/grub/splash.xpm.gz Pretty picture behind the menu. default 0 Default boot entry (numbering starts at 0). timeout 30 Menu timeout period in seconds. password -md5 xxxxxxx Use grub-md5-crypt to encode password.
These lines specify the image displayed behind the boot menu, the menu timeout period and default entry to boot, and the boot password.
The remainder of the file specifies the items on the boot menu. Here are two examples that boot the Linux operating system on the first partition on the first hard disk (selecting different kernels):
title Linux root (hd0,0) kernel /vmlinuz ro root=/dev/hda2 initrd /initrd.img title Test-Linux root (hd0,0) kernel /vmlinuz-test ro root=/dev/hda3 initrd /initrd.img-test
title lines indicate the menu item text. The
specify the partition where the boot loader is located. All directory
references are assumed to be relative to the root of this partition. Thus, the
location of the
vmlinuz files specified in the
kernel lines is in
the root directory of this partition.
kernel lines specify the path to the Linux kernel in each case,
along with any parameters to be passed to it. In this case, a separate /boot
partition is being used, so the
root parameter is passed to the
kernel; the latter indicates the location of the system root directory (such as /). Thus, we can tell that the kernel images reside at /boot/vmlinuz*
from the point of view of the booted Linux system. The
similarly specify the path to the initrd.img file (if used).
Booting FreeBSD is also very simple:
title FreeBSD # use the 1st BSD subpartition in disk 1 partition 3 root (hd0,2,a) kernel /boot/loader
This stanza again specifies the boot partition and locates the FreeBSD final-stage boot loader. This is the recommended practice (rather than directly invoking the FreeBSD kernel).
This stanza defines a bootable Windows partition:
title Win2K root (hd0,2) makeactive chainloader +1
The boot partition is specified in the usual way. The
command activates the partition, and the
chainloader command hands off
the boot process to local boot loader (for example, NTLDR).
In general, GRUB can boot operating systems on any disk. However, in some cases, it is easier to boot non-Unix operating systems on the second hard disk if you logically "swap" the first two drives. GRUB uses entries like these to do so:
map (hd0) (hd1) map (hd1) (hd0)
GRUB also has the nice feature of remembering what operating system was last
booted and making it the default for the next time. To enable this capability,
default entry to
saved (in the general section), and add a
savedefault directive to the end of each stanza:
title Linux ... savedefault
Once you've created the configuration file, installing GRUB is very easy. It
is done with the
grub-install utility that is included with the package.
This tool has the following general syntax:
# grub-install [--root-directory=/dir] disk
where disk is the boot partition, specified in either GRUB's format or
the local format (for example,
--root-directory option specifies the directory location of a
separate boot partition (for example,
/boot under Linux).
For more information about GRUB, consult the following:
If you liked this article and would like to receive the free ESA3 newsletter, you can sign up here.
Æleen Frisch has been a system administrator for over 20 years, tending a plethora of VMS, Unix, Macintosh, and Windows systems. If you liked this article and would like to receive the free ESA3 newsletter, you can sign up at http://www.aeleen.com/esa3_news.htm.
O'Reilly & Associates recently released (August 2002) Essential System Administration, 3rd Edition.
Sample Chapter 11, "Backup and Restore," is available free online.
For more information, or to order the book, click here.
Return to ONLamp.com.
Copyright © 2009 O'Reilly Media, Inc.