Выбрать главу

10.5.2. How Does It Work?

GRUB actually consists of four pieces of software, plus some utilities:

stage 1

The boot record. This tiny piece of code is less than 512 bytes long.

stage 1.5

Additional drivers for filesystems, such as ext2, to enable GRUB to find the stage 2 files.

stage 2

The standalone GRUB command shell and menu program.

/sbin/grub

A version of the GRUB command shell that can be executed inside a running Fedora system.

During boot, the system BIOS loads stage 1 as the boot record and executes it, which then loads stage 1.5 (if necessary) and finds stage 2 . stage 2 then seeks out the GRUB configuration file menu.lst (a symbolic link to grub.conf , which the Fedora developers apparently consider to be a better name).

The GRUB command shell supports over three dozen commands; most of these are never used except by experts and developers. Instead, most users interact with the GRUB menu.

The grub.conf file permits a set of boot options to be presented to the user as a menu entry, removing most of the complexity from the user's view.

A typical Linux entry in grub.conf sets the root filesystem, which is mounted by GRUB to enable access to the kernel and other boot drives. The entry also specifies the name of the kernel and initrd ramdisk to be loaded into memory, and also indicates any configuration options that are to be passed to the kernel.

10.5.3. What About...

10.5.3.1. ...an archive of GRUB splash images?

The author of the splash-image code maintains a small gallery of tested splash images at http://ruslug.rutgers.edu/~mcgrof/grub-images/images/ and an archive at http://ruslug.rutgers.edu/~mcgrof/grub-images/images/working-splashimages/ .

10.5.3.2. ...dual-booting between different Linux distributions?

This works well. Simply add the entries for the other Linux distributions to the active /boot/grub/grub.conf (or /boot/grub/menu.lst ) file. This can be done by specifying that the second Linux distribution install GRUB at the start of that distribution's root filesystem partition instead of placing it in the master boot record for the drive. Then copy the /boot/grub/grub.conf entries from the second Linux distribution to the first one.

10.5.4. Where Can I Learn More?

 The Grub manuaclass="underline" http://www.gnu.org/software/grub/manual/ (also installed as an info document in Fedora Core)

 The Grub web site: http://www.gnu.org/software/grub/

 The sample configuration file /usr/share/doc/grub-0.95/menu.lst

 The manpage for convert

10.6. Using Rescue Mode on an Installation Disc

The Fedora Core installation DVDor disc 1 of the CD setcan be used to boot into a rescue mode , which lets you access a Fedora system installed on a hard disk without booting from that hard disk. This can be used to recover from many types of system failure or badly misconfigured startup scripts.

10.6.1. How Do I Do That?

Inset your Fedora installation disc (DVD or CD 1) into the system and boot from it. At the boot prompt, enter:

boot: linux rescue

You will be presented with the standard language and keyboard menus (see Figures 1-5 and 1-6 in Chapter 1), and then the question shown in Figure 10-26 will be displayed.

Figure 10-26. Network interface question

If you want to be able to transfer files to and from the system (for example, to back up critical data), answer Yes; otherwise, answer No. If you answer Yes, the standard network configuration dialog will appear, enabling you to select DHCP network configuration or manually enter the network details.

Figure 10-27 shows the next screen, which offers to mount your hard disk directories for you. If you need to access files on your hard disk, select Continue; if you need to access files on your hard disk but want to avoid the possibility of damaging any files, select Read-Only; and if you do not want to mount the hard disk filesystems (for example, because you want to work on the filesystems first, resizing or repairing them), select Skip.

Figure 10-27. Hard disk mounting dialog

Figure 10-28 shows the final dialog that will be displayed before a root shell is opened, which informs you whether the hard disk filesystems were mounted. Select OK to proceed to a root shell.

Figure 10-28. Final dialog before the rescue-mode shell

A minimal environment is available in the rescue-mode shell, providing access to the most important system administration commands.

If you requested that the hard disk filesystems be mounted, the mount point will be /mnt/sysimage , and the mounts will be cascaded properly. Therefore, if you have separate /boot and /home filesystems, they will be mounted under /mnt/sysimage/boot and /mnt/sysimage/home .

If you selected a read/write mount, you can temporarily make the root directory of the hard disk your root directory using the chroot command:

sh-3.1# chroot /mnt/sysimage

You can now access directories in their usual locations ( /etc , /home , and so forth), and you'll have access to all of the software installed on the hard disk.

When you issue the chroot command, you will no longer be accessing the software on the installation disc. Therefore, if the commands installed on the hard disk filesystems are corrupted or damaged, you will be using the corrupted or damaged versions. Likewise, if the software on your hard disk is newer than the software on the installation disc, you will be using the newer versions. 

Press Ctrl-D (for done) to exit from the chroot shell and return to the normal rescue shell.

If you chose not to mount your hard disk filesystems, any LVM volume groups on your hard disks will be inaccessible. To access the VGs, issue these commands:

sh-3.1# lvm vgscan

Reading all physical volumes. This may take a while...

Found volume group "main" using metadata type lvm2

sh-3.1# lvm vgchange -ay

2 logical volumes in volume group "main" now active

You can then access the logical volumes as /dev/<pv>/<lv> (for example, /dev/main/root ).

When you are finished with the shell, press Ctrl-D. The system will automatically reboot.