Some things that you run into during installation merit whole discussions by themselves. Rather than bog down the procedures with details that not everyone needs, I have added the following topics to this section. Descriptions cover things such as reclaiming disk space and partitioning.
The hard disk (or disks) on your computer provides the permanent storage area for your data files, applications programs, and the operating system (such as Fedora). Partitioning is the act of dividing a disk into logical areas that can be worked with separately. There are several reasons you may want to do partitioning:
Multiple operating systems — If you install Fedora on a PC that already has a Windows operating system, you may want to keep both operating systems on the computer. To run efficiently, they must exist on completely separate partitions. When your computer boots, you can choose which system to run.
Multiple partitions within an operating system — To protect from having your entire operating system run out of disk space, people often assign separate partitions to different areas of the Linux file system. For example, if /home and /var were assigned to separate partitions, then a gluttonous user who fills up the /home partition wouldn’t prevent logging daemons from continuing to write to log files in the /var/log directory.
Multiple partitions also make it easier to do certain kinds of backups (such as an image backup). For example, an image backup of /home would be much faster (and probably more useful) than an image backup of the root file system (/).
Different file system types — Different kinds of file systems that have different structures. File systems of different types must be on their own partitions. In Fedora Core, you need at least one file system type for / (typically ext3) and one for your swap area. File systems on CD-ROM use the iso9660 file system type.
When you create partitions for Fedora, you will usually assign the file system type as Linux native (using the ext3 type). Reasons to use other types include needing a file system that allows particularly long filenames or many inodes (each file consumes an inode).
For example, if you set up a news server, it can use many inodes to store news articles. Another reason for using a different file system type is to copy an image backup tape from another operating system to your local disk (such as one from an OS/2 or Minix operating system).
If you have only used Windows operating systems before, you probably had your whole hard disk assigned to C: and never thought about partitions. With Fedora Core, you can do a Server class of install (and have Linux erase the whole disk, take it over, and partition it) or a Personal Desktop or Workstation class (and have Linux keep separate partitions for Windows 9x/2000/NT/XP and Linux). With the latest version of Fedora Core, you also have the opportunity to view and change the default partitioning for the different installation types.
During installation, Fedora enables you to partition your hard disk using the Disk Druid utility (a graphical partitioning tool). The following sections describe how to use Disk Druid (during installation) or fdisk (when Fedora is up and running). See the section “Tips for creating partitions” for some ideas for creating disk partitions.
During installation, you are given the opportunity to change how your hard disk is partitioned. Fedora recommends using the Disk Druid. The Disk Druid screen is divided into two sections. The top shows general information about each hard disk. The bottom shows details of each partition. Figure 2-2 shows an example of the Disk Druid window.
Figure 2-2: Partition your disk during installation from the Disk Setup window.
For each of the hard disk partitions, you can see:
Device — The device name is the name representing the hard disk partition in the /dev directory. Each disk partition device begins with two letters: hd for IDE disks, sd for SCSI disks, ed for ESDI disks, or xd for XT disks. After that is a single letter representing the number of the disk (disk 1 is a, disk 2 is b, disk 3 is c, and so on). The partition number for that disk (1, 2, 3, and so on) follows that.
Mount Point/Raid/Volume — The directory where the partition is connected into the Linux file system (if it is). You must assign the root partition (/) to a native Linux partition before you can proceed. If you are using RAID or LVM, the name of the RAID device or LVM volume appears here.
Type — The type of file system that is installed on the disk partition. In most cases, the file system will be Linux (ext3), Win VFAT (vfat), or Linux swap. However, you can also use the previous Linux file system (ext2), physical volume (LVM), or software RAID.
Format — Indicates whether (check mark) or not (no check mark) the installation process should format the hard disk partition. Partitions marked with a check are erased! So, on a multiboot system, be sure your Windows partitions, as well as other partitions containing data are not checked!
Size (MB) — The amount of disk space allocated for the partition. If you selected to let the partition grow to fill the existing space, this number may be much larger than the requested amount.
Start/End — Represents the partition’s starting and ending cylinders on the hard disk.
In the top section, you can see each of the hard disks that are connected to your computer. The drive name is shown first. The Geometry section (Geom) shows the numbers of cylinders, heads, and sectors, respectively, on the disk. That’s followed by the model name of the disk. The total amount of disk space, the amount used, and the amount free are shown in megabytes.
There are different opinions about how to divide up a hard disk. Here are some issues:
Do you want to install another operating system? If you want Windows on your computer along with Linux, you will need at least one Windows (Win95 FAT16, VFAT, or NTFS type), one Linux (Linux ext3), and one Linux swap partition.
Is it a multiuser system? If you are using the system yourself, you probably don’t need many partitions. One reason for partitioning an operating system is to keep the entire system from running out of disk space at once. That also serves to put boundaries on what an individual can use up in his or her home directory (although disk quotas are good for that as well).
Do you have multiple hard disks? You need at least one partition per hard disk. If your system has two hard disks, you may assign one to / and one to /home (if you have lots of users) or /var (if the computer is a server sharing lots of data).
Before you can add a partition, there needs to be some free space available on your hard disk. If all space on your hard disk is currently assigned to one partition (as it often is in DOS or Windows), you must delete or resize that partition before you can claim space on another partition. The section on reclaiming disk space discusses how to add a partition without losing information in your existing single-partition system.
Make sure that any data that you want to keep is backed up before you delete the partition. When you delete a partition, all its data is gone.
Disk Druid is less flexible, but more intuitive, than the fdisk utility. Disk Druid lets you delete, add, and edit partitions.
If you create multiple partitions, make sure that there is enough room in the right places to complete the installation. For example, most of the Linux software is installed in the /usr directory (and subdirectories), whereas most user data are eventually added to the /home or /var directories.
To delete a partition in Disk Druid, do the following:
Select a partition from the list of Current Disk Partitions on the main Disk Druid window (click it or use the arrow keys).
To delete the partition, click Delete.
When asked to confirm the deletion, click Delete.
If you made a mistake, click Reset to return to the partitioning as it was when you started Disk Druid.
To add a partition in Disk Druid, follow these steps from the main Disk Druid window:
Select New. A window appears, enabling you to create a new partition.
Type the name of the Mount Point (the directory where this partition will connect to the Linux file system). You need at least a root (/) partition and a swap partition.
Select the type of file system to be used on the partition. You can select from Linux native (ext2 or preferably ext3), software RAID, Linux swap (swap), physical volume (LVM), or Windows FAT (vfat).
To create a different file system type than those shown, leave the space you want to use free for now. After installation is complete, use fdisk to create a partition of the type you want.
Type the number of megabytes to be used for the partition (in the Size field). If you want this partition to grow to fill the rest of the hard disk, you can put any number in this field (1 will do fine).
If you have more than one hard disk, select the disk on which you want to put the partition from the Allowable Drives box.
Type the size of the partition (in megabytes) into the Size (MB) box.
Select one of the following Additional Size Options:
Fixed size — Click here to use only the number of megabytes you entered into the Size text box when you create the partition.
Fill all space up to (MB) — If you want to use all remaining space up to a certain number of megabytes, click here and fill in the number. (You may want to do this if you are creating a VFAT partition up to the 2048MB limit that Disk Druid can create.)
Fill to maximum allowable size — If you want this partition to grow to fill the rest of the disk, click here.
Optionally select Force to Be a Primary Partition if you want to be sure to be able to boot the partition or Check for Bad Blocks if you want to have the partition checked for errors.
Select OK if everything is correct. (The changes don’t take effect until several steps later when you are asked to begin installing the packages.)
To edit a partition in Disk Druid from the main Disk Druid window, follow these steps:
Click the partition you want to edit.
Click the Edit button. A window appears, ready to let you edit the partition definition.
Change any of the attributes (as described in the add partition procedure). For a new install, you may need to add the mount point (/) for your primary Linux partition.
Select OK. (The changes don’t take effect until several steps later, when you are asked to begin installing the packages.)
If you want to create a RAID device, you need to first create at least two RAID partitions. Then click the RAID button to make the two partitions into a RAID device. For more information on RAID, refer to Chapter 10 or the Red Hat Linux Customization guide. The latter is available from any Red Hat mirror site (such as ftp.redhat.com) here: pub/redhat/linux/current/en/doc/RH DOCS/rhl-cg-en-9/*. To create an LVM volume group, you must create at least one partition of type "physical volume (LVM)."
The fdisk utility does the same job as Disk Druid, but it’s no longer offered as an option during Fedora installation. (If you are old school, however, you could press Ctrl+Alt+F2 during the installation process and run fdisk from the shell to partition your disk.)
The following procedures are performed from the command line as root user.
Remember that any partition commands can easily erase your disk or make it inaccessible. Back up critical data before using any tool to change partitions! Then be very careful about the changes you do make. Keeping an emergency boot disk handy is a good idea, too.
The fdisk command is one that is available on many different operating systems (although it looks and behaves differently on each). In Linux, fdisk is a menu-based command. To use fdisk to list all your partitions, type the following (as root user):
# fdisk –l Disk /dev/hda: 40.0 GB, 40020664320 bytes 255 heads, 63 sectors/track, 4865 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 13 104391 83 Linux /dev/hda2 14 4833 38716650 83 Linux /dev/hda3 4834 4865 257040 82 Linux swap
To see how each partition is being used on your current system, type the following:
# df –h Filesystem Size Used Avail Use% Mounted on /dev/hda2 37G 5.4G 30G 16% / /dev/hda1 99M 8.6M 86M 10% /boot none 61M 0 61M 0% /dev/shm
From the output of df, you can see that the root of your Linux system (/) is on the /dev/hda2 partition and that the /dev/hda1 partition is used for /boot.
If this had been a dual-boot system (with Windows 98), you might have seen a Windows partition from fdisk that looked like the following:
/dev/hda1 * 1 83 666666+ b Win95 FAT32
You could mount that partition in Linux (to get to your Windows files when Linux is booted) by typing:
# mkdir /mnt/win
# mount -t vfat /dev/hda1 /mnt/win
Before using fdisk to change your partitions, I strongly recommend running the df –h command to see how your partitions are currently being defined. This will help reduce the risk of changing or deleting the wrong partition.
To use fdisk to change your partitions, begin (as root user) by typing:
# fdisk device
where device is replaced by the name of the device you want to work with. For example, here are some of your choices:
For the first IDE hard disk; hdb, hdc, and so on for other IDE disks.
For the first SCSI hard disk; sdb, sdc, and so on for other SCSI disks.
For a RAID device.
Also for a RAID device.
After you have started fdisk, type m to see the options. Here is what you can do with fdisk:
Delete a partition — Type d and you are asked to enter a partition number on the current hard disk. Type the partition number and press Enter. For example, /dev/sda2 would be partition number 2. (The deletion won’t take effect until you write the change. Until then, it’s not too late to back out.)
Create a partition — If you have free space, you can add a new partition. Type n and you are asked to enter l for a logical partition (5 or over) or p for a primary partition (1–4). Enter a partition number from the available range. Then choose the first cylinder number from those available. (The output from fdisk –l shown earlier will show you cylinders being used under the Start and End columns.)
Next, enter the cylinder number the partition will end with (or type the specific number of megabytes or kilobytes you want: for example, +50M or +1024K). You just created an ext3 Linux partition. Again, this change isn’t permanent until you write the changes.
Change the partition type — Press t to choose the type of file system. Enter the partition number of the partition number you want to change. Type the number representing the file system type you want to use in hexadecimal code. (Type L at this point to see a list of file system types and codes.) For a Linux file system, use the number 83; use 82 for a Linux swap partition. For a windows FAT32 file system, you can use the letter b.
Display the partition table — Throughout this process, feel free to type p to display (print on the screen) the partition table as it now stands.
Saving and quitting — If you don’t like a change you make to your partitions, press q to exit without saving. Nothing will have changed on your partition table.
Before you write your changes, display the partition table again and make sure that it is what you want it to be. To write your changes to the partition table, press w. You are warned about how dangerous it is to change partitions and asked to confirm the change.
An alternative to the fdisk command is sfdisk. The sfdisk command is command-line– oriented. Type the full command line to list or change partitions. (See the sfdisk man page for details.)
Changing your disk partitions to handle multiple operating systems can be very tricky. Part of the reason is that each different operating system has its own ideas about how partitioning information should be handled, as well as different tools for doing it. Here are some tips to help you get it right.
If you are creating a dual-boot system, particularly for Windows ME or Windows XP, try to install the Windows operating system first. Otherwise, the Windows installation may make the Linux partitions inaccessible.
The fdisk man page recommends that you use partitioning tools that come with an operating system to create partitions for that operating system. For example, the DOS fdisk knows how to create partitions that DOS will like, and the Fedora fdisk will happily make your Linux partitions. Once your hard disk is set up for dual boot, however, you should probably not go back to Windows-only partitioning tools. Use Linux fdisk or a product made for multiboot systems (such as Partition Magic).
You can have up to 63 partitions on an IDE hard disk. A SCSI hard disk can have up to 15 partitions. You won’t need nearly that many partitions.
If you are using Fedora as a desktop system, you probably don’t need a lot of different partitions within your Linux system. There are, however, some very good reasons for having multiple partitions for Linux systems that are shared by a lot of users or are public Web servers or file servers. Multiple partitions within Fedora offer the following advantages:
Protection from attacks — Denial-of-service attacks sometimes take action that tries to fill up your hard disk. If public areas, such as /var, are on separate partitions, a successful attack can fill up a partition without shutting down the whole computer. Because /var is the default location for Web and FTP servers, and therefore might hold a lot of data, often entire hard disks are assigned to the /var file system alone.
Protection from corrupted file systems — If you have only one file system (/), corruption of that file system can cause the whole Fedora system to be damaged. Corruption of a smaller partition can be easier to correct and can often allow the computer to stay in service while the corruption is fixed.
Here are some directories that you may want to consider making into separate file system partitions.
/boot — Sometimes the BIOS in older PCs can access only the first 1024 cylinders of your hard disk. To make sure that the information in your /boot directory is accessible to the BIOS, create a separate disk partition (of only about 100MB) for /boot and make sure that it exists below cylinder 1024. Then, the rest of your Linux system can exist outside of that 1024-cylinder boundary if you like. Even with several boot images, there is rarely a reason for /boot to be larger than 100MB. For newer hard disks, you can sometimes avoid this problem by selecting the Linear Mode check box during installation. Then the boot partition can be anywhere on the disk.
/usr — This directory structure contains most of the applications and utilities available to Fedora users. Having /usr on a separate partition lets you mount that file system as read-only after the operating system has been installed. This prevents attackers from replacing or removing important system applications with their own versions that may cause security problems. A separate /usr partition is also useful if you have diskless workstations on your local network. Using NFS, you can share /usr over the network with those workstations.
/var — Your FTP (/var/ftp) and Web-server (/var/www) directories are, by default, stored under /var. Having a separate /var partition can prevent an attack on those facilities from corrupting or filling up your entire hard disk.
/home — Because your user account directories are located in this directory, having a separate /home account can prevent an indiscriminate user from filling up the entire hard disk. (Disk quotas, see Chapter 10, represent another way of controlling disk use.)
/tmp — Protecting /tmp from the rest of the hard disk by placing it on a separate partition can ensure that applications that need to write to temporary files in /tmp are able to complete their processing, even if the rest of the disk fills up.
Although people who use Fedora casually rarely see a need for lots of partitions, those who maintain and occasionally have to recover large systems are thankful when the system they need to fix has several partitions. Multiple partitions can localize deliberate damage (such as denial-of-service attacks), problems from errant users, and accidental file system corruption.
Chances are that your PC came with a Windows operating system already installed on the entire disk. Installing Fedora while keeping Windows on your hard disk presents a problem. Fedora Core and Windows operating systems need to be put on separate disk partitions, and right now there is only one partition (and it isn’t for Fedora Core).
Earlier releases of Fedora Core included a FIPS utility for resizing FAT and VFAT file systems. Since FIPS is no longer included with Fedora Core, and since most Windows file systems are NTFS these days, no description of FIPS is included here. (A description of FIPS from an earlier edition of this book is included at the Wiley Web site: www.wiley.com/go/fedora3bible.)
If you are in the predicament where your whole hard disk is consumed by Windows, but you have a lot of unused space in your Windows NTFS partition (at least 2GB or more), there are procedures you can follow to reclaim the disk space. This section describes some commercial and open source tools you can use to resize your NTFS partitions.
If, instead of adding Linux to an existing Windows computer, you want to add Windows to your Linux computer, refer to the Linux+Windows+Grub HOWTO. For information on installing Windows NT and Linux on the same computer, refer to the Linux+Windows NT mini-HOWTO.These and other Linux HOWTOs are available from the Linux Documentation Project (www.tldp.org).
Read this section before you begin resizing your Windows partitions!
Open source NTFS file system resizing tools are relatively new and come with some risks. To find out what kind of file system is being used on your Windows computer, do the following while Windows is running:
Double-click the My Computer icon.
Right-click the hard-disk (C:) icon and select Properties.
Look at the File system line. If it shows the file system type as FAT or FAT32 the disk partition can be resized with FIPS. If it shows the file system as NTFS, you can consider several open source and commercial products for resizing your NTFS file system.
If you are using a Windows 95, Windows 98, or Windows ME computer, providing that you have enough free disk space on the partition, you can probably use FIPS to resize it. A Windows XP, 2000 or NT4 system will almost surely require NTFS resizing tools. The rest of this section describes NTFS resizing tools.
The problem with resizing Windows NTFS file systems is that the specifications for how NTFS is formatted are not public. However, there are several open source and commercial products available for resizing NTFS file systems that have been reported to work well.
In the open source arena, the Linux-NTFS project (http://linux-ntfs.sourceforge.net ) has made great strides in creating tools to resize your Linux partition. Although the NTFS tools available with this project are not included in Fedora or Red Hat Enterprise Linux, you can download those tools on various LiveCD Linux versions and use them to resize your NTFS partitions before installing Fedora Core.
Resizing an NTFS partition is an inherently dangerous process. Please backup any important data from your Windows system before trying to resize an NTFS partition. This software comes with no warranty, so if you decide to try it you are on your own.
Issues related to resizing NTFS file systems and finding tools to do so are contained on the Ntfsresize FAQ (mlf.linux.rulez.org/mlf/ezaz/ntfsresize.html). One bootable Linux described there that includes NTFS resizing tools is the System Rescue CD project. You can download, burn and boot the System Rescue CD to resize your NTFS partition. Here's how:
Go to the System Rescue CD site and download the latest System Rescue CD (www.sysresccd.org/download.en.php).
Burn the System Rescue CD image to a CD. (Chapter 5 describes how to burn CDs.)
Insert the System Rescue CD into the computer containing the NTFS file system you want to resize and reboot the computer (press Enter at the boot prompt).
When System Rescue CD finishes booting, type the following to resize your hard disk:
When the run_qtparted window opens, select the hard disk (from the left column) that you want to resize. The partitions on that hard disk appear on the right column.
Select the Windows partition you want to resize (a Windows icon will appear next to the partition), then choose Operations ® Resize.
In the box that appears, click the down arrow next to the amount of disk space on the partition to free some of its space for resizing.
Click File ® Commit to commit the changes.
At this point, the free space you indicated when you resized your NTFS partition should be available to use to install Fedora Core. If you feel more comfortable resizing your hard disk using a commercial product, there are several such products available today:
Despite the fact that I have successfully resized several NTFS partitions using the run_qtparted utility, I still recommend caution (and a good backup of your data) before proceeding. As for the commercial products listed below, I have not tested the products so I name them here only because I have heard good reports of success from others. User beware.
Partition Magic — I’ve heard good reports from people using Partition Magic (www.powerquest.com/partitionmagic) to resize NTFS partitions. Partition Magic also helps you create new partitions and manage them. It supports Windows XP Professional/Home, Windows 95b-98SE, Windows Me, Windows 2000 Professional, and NT 4.0 workstation (SP6a). The cost is currently $69.95.
Acronis OS Selector — This is another well-regarded product for managing, creating, and resizing partitions, which is not included in the Acronis Disk Director Suite. It supports a variety of file system types, including FAT12, FAT16, FAT32, NTFS, and Linux partition types (ext2, ext3 and Linux ReiserFS). It also supports the same Windows platforms that Partition Magic does. The cost is currently $49.99 from www.acronis.com/products/diskdirector.
As I mentioned earlier, if your Windows partition is FAT or VFAT you can continue with the procedure in the next session to resize your hard disk.
A boot loader lets you choose when and how to boot the bootable operating systems installed on your computer’s hard disks. GRUB is the only boot loader offered for you to configure during Fedora Core 3 installation. However, Fedora also includes the LILO boot loader, if you want to configure that after Fedora is installed. The following sections describe both GRUB and LILO boot loaders.
With multiple operating systems installed and several partitions set up, how does your computer know which operating system to start? To select and manage which partition is booted and how it is booted, you need a boot loader. The boot loader that is installed by default with Fedora is called the GRand Unified Boot loader (GRUB).
GRUB is a GNU software package (www.gnu.org/software/grub) that replaced the LILO as the default boot loader in Fedora. GRUB offers the following features:
Support for multiple executable formats.
Support for multiboot operating systems (such as Fedora, FreeBSD, NetBSD, OpenBSD, and other Linux systems).
Support for non-multiboot operating systems (such as Windows 95, Windows 98, Windows NT, Windows ME, Windows XP, and OS/2) via a chain-loading function. Chain-loading is the act of loading another boot loader (presumably one that is specific to the proprietary operating system) from GRUB to start the selected operating system.
Support for multiple file system types.
Support for automatic decompression of boot images.
Support for downloading boot images from a network.
For more information on how GRUB works, type man grub or info grub. The info command contains more details about GRUB.
When you install Fedora, information needed to boot your computer (with one or more operating systems) is automatically set up and ready to go. Simply restart your computer. When you see the GRUB boot screen (it says GRUB at the top and lists bootable partitions below it), do one of the following:
Default —If you do nothing, the default operating system will boot automatically after a few seconds.
Select an operating system — Use the up and down arrow keys to select any of the operating systems shown on the screen. Then press Enter to boot that operating system.
Edit the boot process — If you want to change any of the options used during the boot process, use the arrow keys to select the operating system you want and type e to select it. Follow the next procedure to change your boot options temporarily.
If you want to change your boot options so that they take effect every time you boot your computer, see the section on permanently changing boot options. Changing those options involves editing the /boot/grub/grub.conf file.
From the GRUB boot screen, you can select to change or add boot options for the current boot session. First, select the operating system you want (using the arrow keys) and type e (as described earlier). You will see a graphical screen that contains information like the following:
GRUB version 0.95 (639K lower / 128768K upper memory) root (hd0,0) kernel /boot/vmlinuz-2.6.8-1.541 ro root=LABEL=/ initrd /boot/initrd-2.6.8-1. 541.img Use the and ¯ keys to select which entry is highlighted. Press 'b' to boot, 'e' to edit the selected command in the boot sequence, 'c' for a command-line, 'o' to open a new line after ('O' for before) the selected line, 'd' to remove the selected line, or escape to go back to the main menu.
There are three lines in the example of the GRUB editing screen that identify the boot process for the operating system you chose. The first line (beginning with root) shows that the entry for the GRUB boot loader is on the first partition of the first hard disk (hd0,0). GRUB represents the hard disk as hd, regardless of whether it is a SCSI, IDE, or other type of disk. You just count the drive number and partition number, starting from zero.
The second line of the example (beginning with kernel) identifies the boot image (/boot/vmlinuz-2.6.8-1. 541) and several options. The options identify the partition as initially being loaded ro (read-only) and the location of the root file system on a partition with the label LABEL=/. The third line (starting with initrd) identifies the location of the initial RAM disk, which contains the minimum files and directories needed during the boot process.
If you are going to change any of the lines related to the boot process, you would probably change only the second line to add or remove boot options. Here is how you do that:
Position the cursor on the kernel line and type e.
Either add or remove options after the name of the boot image. You can use a minimal set of bash shell command-line editing features to edit the line. You can even use command completion (type part of a filename and press Tab to complete it). Here are a few options you may want to add or delete:
Boot to a shell: If you forgot your root password or if your boot process hangs, you can boot directly to a shell by adding init=/bin/sh to the boot line. (The file system is mounted read-only, so you can copy files out. You need to remount the file system with read/write permission to be able to change files.)
Select a run level: If you want to boot to a particular run level, you can add the word linux, followed by the number of the run level you want. For example, to have Fedora boot to run level 3 (multiuser plus networking mode), add linux 3 to the end of the boot line. You can also boot to single-user mode (1), multi-user mode (2), or X GUI mode (5). Level 3 is a good choice if your GUI is temporarily broken.
Press Enter to return to the editing screen.
Type b to boot the computer with the new options. The next time you boot your computer, the new options will not be saved. To add options so they are saved permanently, see the next section.
You can change the options that take effect each time you boot your computer by changing the GRUB configuration file. In Fedora, GRUB configuration centers around the /boot/grub/grub.conf file.
The /boot/grub/grub.conf file is created when you install Fedora. Here is an example of a grub.conf file.
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making # changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/hda6 # initrd /initrd-version.img #boot=/dev/hda default=0 timeout=10 splashimage=(hd0,4)/grub/splash.xpm.gz title Fedora Core (2.6.8-1.541) root (hd0,4) kernel /vmlinuz-2.6.8-1.541 ro root=LABEL=/ initrd /initrd-2.6.8-1.541.img title Windows XP rootnoverify (hd0,0) chainloader +1
The default=0 line indicates that the first partition in this list (in this case Fedora Core) will be the one that is booted by default. The line timeout=10 causes GRUB to pause for ten seconds before booting the default partition. (That’s how much time you have to press e if you want to edit the boot line, or to press arrow keys to select a different operating system to boot.)
The splashimage line looks in the fifth partition on the first disk (hd0,4) for the boot partition (in this case /dev/hda5, which is the /boot partition). GRUB loads splash.xpm.gz as the image on the splash screen (/boot/grub/splash.xpm.gz). The splash screen appears as the background of the boot screen.
GRUB indicates disk partitions using the following notation: (hd0,0). The first number represents the disk, and the second is the partition on that disk. So, (hd0,1) is the second partition (1) on the first disk (0).
The two bootable partitions in this example are Fedora and Windows XP. The title lines for each of those partitions are followed by the name that appears on the boot screen to represent each partition.
For the Fedora Core system, the root line indicates the location of the boot partition as the second partition on the first disk. So, to find the bootable kernel (vmlinuz-2.6.8-1.541) and the initrd initial RAM disk boot image that is loaded (initrd-2.6.8-1.541.img), GRUB looks in the root of hd0,4 (which is represented by /dev/hda5 and is eventually mounted as /boot). Other options on the kernel line set the partition as read- only initially (ro) and set the root file system to /dev/hda6.
For the Windows XP partition, the rootnoverify line indicates that GRUB should not try to mount the partition. In this case, Windows ME is on the first partition of the first hard disk (hd0,0) or /dev/hda1. Instead of mounting the partition and passing options to the new operating system, the chainloader +1 indicates to hand control the booting of the operating system to another boot loader. The +1 indicates that the first sector of the partition is used as the boot loader.
Microsoft operating systems require that you use the chainloader to boot them from GRUB.
If you make any changes to the /boot/grub/grub.conf file, you do not need to load those changes. Those changes are automatically picked up by GRUB when you reboot your computer. If you are accustomed to using the LILO boot loader, this may confuse you at first, as LILO requires you to rerun the lilo command for the changes to take effect.
You may have different boot images for kernels that include different features. Here is the procedure for modifying the grub.conf file:
Copy the new image from the directory in which it was created (such as /usr/src/linux-2.4/arch/i386/boot) to the /boot directory. Name the file something that reflects its contents, such as bz-2.4.21. For example:
# cp /usr/src/linux-2.6.8/arch/i386/boot/bzImage /boot/bz-2.6.8
Add several lines to the /boot/grub/grub.conf file so that the image can be started at boot time if it is selected. For example:
title Fedora Core (IPV6 build) root (hd0,4) kernel /bz-2.6.8 ro root=/dev/hda6 initrd /initrd-2.6.8.img
Reboot your computer.
When the GRUB boot screen appears, move your cursor to the title representing the new kernel and press Enter.
The advantage to this approach, as opposed to copying the new boot image over the old one, is that if the kernel fails to boot, you can always go back and restart the old kernel. When you feel confident that the new kernel is working properly, you can use it to replace the old kernel or perhaps just make the new kernel the default boot definition.
LILO stands for LInux LOader. Like other boot loaders, LILO is a program that can stand outside the operating systems installed on the computer so you can choose which system to boot. It also lets you give special options that modify how the operating system is booted.
If LILO is being used on your computer, it is installed in either the master boot record or the first sector of the root partition. The master boot record is read directly by the computer’s BIOS. In general, if LILO is the only loader on your computer, install it in the master boot record. If there is another boot loader already in the master boot record, put LILO in the root partition.
When your computer boots with the Fedora version of LILO installed in the master boot record, a graphical Fedora screen appears, displaying the bootable partitions on the computer. Use the up and down arrow keys on your keyboard to select the one you want and press Enter. Otherwise, the default partition that you set at installation will boot after a few seconds.
If you want to add any special options when you boot, press Ctrl+X. You will see a text-based boot prompt that appears as follows:
LILO pauses for a few seconds and then automatically boots the first image from the default bootable partition. To see the bootable partitions again, quickly press Tab. You may see something similar to the following:
LILO boot: linux linux-up dos boot:
This example shows that three bootable partitions are on your computer, called linux, linux-up, and dos. The first two refer to two different boot images that can boot the Linux partition. The third refers to a bootable DOS partition (presumably containing a Windows operating system). The first bootable partition is loaded if you don’t type anything after a few seconds. Or you could type the name of the other partition to have that boot instead.
If you have multiple boot images, press Shift, and LILO will ask you which image you want to boot. Available boot images and other options are defined in the /etc/lilo.conf file.
The /etc/lilo.conf file is where LILO gets the information it needs to find and start bootable partitions and images. By adding options to the /etc/lilo.conf file, you can change the behavior of the boot process. The following is an example of some of the contents of the /etc/lilo.conf file:
Because LILO is not used by default, there is no /etc/lilo.conf file. However, the Fedora Core installation program creates an /etc/lilo.conf.anaconda file to suit your installation. If you change from GRUB to LILO, you can copy that file to /etc/lilo.conf.
prompt timeout=50 default=linux boot=/dev/hda map=/boot/map install=/boot/boot.b message=/boot/message linear image=/boot/vmlinuz-2.6.8-1.541 label=linux initrd=/boot/initrd-2.6.8-1.541.img read-only root=/dev/hda6 append="root=LABEL=/" other=/dev/hda1 optional label=dos
With prompt on, the boot prompt appears when the system is booted without requiring that any keys are pressed. The timeout value, in this case 50 tenths of a second (5 seconds), defines how long to wait for keyboard input before booting the default boot image. The boot line indicates that the bootable partition is on the hard disk represented by /dev/hda (the first IDE hard disk).
The map line indicates the location of the map file (/boot/map, by default). The map file contains the name and locations of bootable kernel images. The install line indicates that the /boot/boot.b file is used as the new boot sector. The message line tells LILO to display the contents of the /boot/message file when booting (that contains the graphical Fedora boot screen that appears). The linear line causes linear sector addresses to be generated (instead of sector/head/cylinder addresses).
In the sample file, there are two bootable partitions. The first (image=/boot/vmlinuz-2.6.8-1.541) shows an image labeled linux. The root file system (/) for that image is on partition /dev/hda6. Read-only indicates that the file system is first mounted read-only, though it is probably mounted as read/write after a file system check. The inidrd line indicates the location of the initial RAM disk image used to start the system.
The second bootable partition, which is indicated by the word other in this example, is on the /dev/hda1 partition. Because it is a Windows XP system, it is labeled a DOS file system. The table line indicates the device that contains the partition.
Other bootable images are listed in this file, and you can add another boot image yourself (like one you create from reconfiguring your kernel as discussed in the next section) by installing the new image and changing lilo.conf.
After you change lilo.conf, you then must run the lilo command for the changes to take effect. You may have different boot images for kernels that include different features. Here is the procedure for modifying the lilo.conf file:
Copy the new image from the directory in which it was created (such as /usr/src/linux-2.6/arch/i386/boot) to the /boot directory. Name the file something that reflects its contents, such as zImage-2.6.8-1.
Add several lines to the /etc/lilo.conf file so that the image can be started at boot time if it is selected. For example:
Type the lilo -t command (as root user) to test that the changes were okay.
Type the lilo command (with no options) for the changes to be installed.
To boot from this new image, either select new from the graphical boot screen or type new and press Enter at the LILO boot prompt. If five seconds is too quick, increase the timeout value (such as 100 for 10 seconds).
Options that you can use in the /etc/lilo.conf file are divided into global options, per- image options, and kernel options. There is a lot of documentation available for LILO. For more details on any of the options described here or for other options, you can see the lilo.conf manual page (type man lilo.conf) or any of the documents in /usr/share/doc/lilo*/doc.
A few examples follow of global options that you can add to /etc/lilo.conf. Global options apply to LILO as a whole, instead of just to a particular boot image.
You can use the default=label option, where label is replaced by an image’s label name, to indicate that a particular image be used as the default boot image. If that option is excluded, the first image listed in the /etc/lilo.conf file is used as the default. For example, to start the image labeled new by default, add the following line to lilo.conf:
Change the delay from 5 seconds to something greater if you want LILO to wait longer before starting the default image. This gives you more time to boot a different image. To change the value from 5 seconds (50) to 15 seconds (150), add the following line:
You can change the message that appears before the LILO prompt by adding that message to a file and changing the message line. For example, you could create a /boot/boot.message file and add the following words to that file: Choose linux, new, or dos. To have that message appear before the boot prompt, add the following line to /etc/lilo.conf:
All per-image options begin with either an image= line (indicating a Linux kernel) or other= (indicating some other kind of operating system, such as Windows XP). The per- image options apply to particular boot images rather than to all images (as global options do). Along with the image or other line is a label= line, which gives a name to that image. The name is what you would select at boot time to boot that image. Here are some of the options that you can add to each of those image definitions:
lock — This enables automatic recording of boot command lines as the defaults for different boot options.
alias=name — You can replace name with any name. That name becomes an alias for the image name defined in the label option.
password=password — You can password-protect the image by adding a password option line and replacing password with your own password. The password would have to be entered to boot the image.
restricted — This option is used with the password option. It indicates that a password should be used only if command-line options are given when trying to boot the image.
For Linux kernel images, there are specific options that you can use. These options let you deal with hardware issues that can’t be autodetected, or provide information such as how the root file system is mounted. Here are some of kernel image–specific options:
append — Add a string of letters and numbers to this option that need to be passed to the kernel. In particular, these can be parameters that need to be passed to better define the hard disk when some aspect of that disk can’t be autodetected.
ramdisk — Add the size of the RAM disk that you want to use so as to override the size of the RAM disk built into the kernel.
read-only — Indicates to mount the root file system read-only. It is typically remounted read-write after the disk is checked.
read-write — Indicates to mount the root file system read/write.
If you don’t want to use the GRUB boot loader, or if you tried out LILO and want to switch back to GRUB, it’s not hard to change to a different boot loader. To switch your boot loader from GRUB to LILO, do the following:
Configure the /etc/lilo.conf file as described in the "Booting your computer with LILO" section. (Use the contents of /etc/lilo.conf.anaconda to start.)
As root user from a Terminal window, type the following:
The new Master Boot Record is written, including the entries in /etc/lilo.conf.
Reboot your computer. You should see the LILO boot screen.
To change your boot loader from LILO to GRUB, do the following:
Configure the /boot/grub/grub.conf file as described in the "Booting your computer with GRUB" section.
You need to know the device on which you want to install GRUB. For example, to install GRUB on the master boot record of the first disk, type the following as root user from a Terminal window:
# grub-install /dev/hda
The new Master Boot Record is written to boot with the GRUB boot loader.
Reboot your computer. You should see the GRUB boot screen.