GRUB installation, configuration and usage summary into the sun (http://www.suncn.net/)
Author: Unknown Date: 2004-07-27 0:28:19
(1) Installing the GRUB when installing Linux. When installing the redhat Linux, the installation boot will be prompted. If GRUB is selected as the boot program, it is recommended to put the GRUB to the hard disk Mbr.grub can also boot other operating systems, such as FreeBSD, NetBSD , OpenBSD, GNU Hurd and DOS, and Windows 95, 98, NT, 2000, XP. (2) Once the GRUB configuration has chosen GRUB as the boot program, let's take a look at its configuration ./boot/grub/grub.conf is GRUB to generate a boot selection menu and set some options. Below is my grub.conf : # ========== Example Start =========== # Grub.conf generated by Anaconda ## Note That You do Not Have to Run 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, 6) # kernel / vmlinuz-version row = / dev / hda10 # initrd / initrd -version.img # Boot = / dev / hdadefault = 0timeout = 10splashImage = (hd0, 6) /grub/splash.xpm.gz# -> redhat Linux 8.0 <- title red Hat Linux (2.4.18-14) Root (HD0, 6) kernel /Vmlinuz-2.4.18-14 ROOT = label = / init /initrd-2.4.18-14.img# -> Microsoft Windows XP <- Title Microsoft Windows XProotnoverified (HD0, 0 ) CHAINLOADER 1 # =========== Example end ========== Configuration option explains: The notes start with "#". I have two operating systems here. They are Red Hat Linux and Microsoft Windows XP. Where the timeout identifies the default time, I set it to 10 seconds, more than 10 seconds users have not made a selection, will automatically select the default operating system (I default it here is Redhat Linux 8.0). The default operating system is controlled by the default. The number after Default indicates that the first is the default, and 0 means the first one, 1 means the second. So if you want to modify the default operating system, Modify the number after default.title Is the name of the operating system, GRUB does not support Chinese (a little regret). SplashImage, a background image specified for a GRUB interface, interested friends can modify the background of GRUB! Root (HD0, 6) logo from the first hard disk, The seventh partition is launched to boot the kernel. Note that the root partitions here are different from Linux root partitions. This root non-robe is also! GRUB's hard disk identification method is a bit different from Linux. The first primary partition in Linux is HDA1, The second primary partition is HDA1, and the first logical partition is HDA5, and in the grub is identified in (HDX, Y), such as the first primary partition (HD0, 0), first logical partition ( HD0, 1) According to this class. So this root is behind your / boot's partition ID. I know where the kernel is, but also specifically indicates which file is a kernel file, which is the work of Kernel.
Kernel /Vmlinuz-2.2.18-14 Ro root = label = /. Description /Boot/VMLINUZ-2.2.18-14 is the kernel to be loaded. The following are the parameters passing to the kernel. RO is readonly meaning. Note that the path in front of the kernel is "/" because my Boot is divided separately. If you don't have a separate partition for the boot, then the path in front of the kernel is "/ boot". Initrd used to initially Linux Image, and Set the corresponding parameters to see the Windows definition segment. Here, I added an item to boot WindowsXP. To do this, GRUB uses "chain loader". The chain loader is loaded into WinXP's own boot loader in the boot record of the partition (HD0, 0) and then guides it. This is why this technology is called chain load - it creates a chain from the boot loader to another. This chain load technology can be used to guide any version of DOS or Windows. If you have Win98, WinMe, Win2K, WinXP in your computer, ChainLoader will boot the guidance to win the NTLoader. (3) The production of the GRUB boot disk To make a boot disk, you need to perform some simple steps. First, create an EXT2 file system on a new floppy disk. Then, install it and copy some of the GRUB files to the file system, and finally run the "GRUB" program, which will be responsible for setting the floppy boot sector. Insert an empty disk into a 1.44MB floppy drive, enter: # mke2fs / dev / fd0 After the EXT2 file system is created, you need to install the file system: # mount / dev / fd0 / mnt / floppy Now, you need to create some directories, and will Some key files (these files have been installed originally when installing GRUB) Copy to floppy disk: # mkdir / mnt / floppy / boot # mkdir / mnt / floppy / boot / grub # cp / boot / grub / stage1 / mnt / floppy / boot / GRUB # CP / Boot / Grub / Stage2 / MNT / FLOPPY / BOOT / GRUB has a step to get available bootes. In Linux Bash, "GRUB" is run from the root user, which is very interesting and worth noting because it is actually a semi-functional version of the GRUB boot loader. Although Linux has been launched and running, you can still run GRUB and perform some tasks, and its interface is identical to the interface (ie, the GRUB console) when you use a GRUB boot disk or the GRUB is installed to the hard drive MBR. At GRUB> prompt, enter: GRUB> root (fd0) GRUB> Setup (fd0) GRUB> Quit now, the boot disk is completed. (4) Restore the grub destroyed by Windows. If you use GRUB to boot Linux and Windows, when Windows is reinstalled, it will destroy the GRUB in the MBR, and you need to restore GRUB.1. Turn the Linux installation CD Zhang put into the optical drive, then restart the machine, and boot the system in BOIS. 2. After the installation interface comes out, press the [F4] button, which is Linux Rescue mode. 3. A series of keyboards and several simple formulations, [Continue] afterwards. . . This process, I don't say it, it is relatively simple.
4. Then there will be such a prompt: SH # 5. We can operate GRUB. Enter GRUB: SH # grub will appear like this: GRUB> We can enter behind, enter: GRUB> root (HDX, Y) GRUB> Setup (HD0) If there will be a success ... Here X, if it is a disk, it is 0, if you installed Linux root partition on the second hard disk , That x is 1; y, is the root partition where Linux system is located. Setup (HD0) is to write GRUB to the MBR of the hard disk.
(5). With NTLoader to guide Linux. If you don't choose to install GRUB when installing Linux, don't worry, let's take a look at how to install GRUB after installing Linux. And use Windows NTLoader to boot Linux.1. Install GRUB I GRUB is the grub installation package with redhat 8.0: GRUB-0.92-7.rpm installation: rpm -ivh grub-0.92-7.rpm Other installation methods, as long as you install GRUB, it is available. RH8 default The GRUB, 1, 2 steps can be saved. 2. Establish GRUB Environment CP / USR / Share / GRUB / I386-PC / * / Boot / GRUB 3. Generate GRUB Profile /Boot/grub/Menu.conf The grub.conf mentioned above generates a configuration file. Note, here my Linux is / dev / hda4, so menu.conf is (HD0, 3), you may not be complete, you can't fully "Painting Scoop"! The partition position in the third step in Install should also be consistent with your system. 3. Install the GRUB to Linux partition boot to install the GRUB's Stage1 to the / dev / hda4 Boot sector (HD0, " 3). The process is as follows: / sbin / grub (running grub) GRUB> Install (HD0, 3) / boot / grub / stage1 d (hd0, 3) (HD0, 3) / boot / grub / stage2 p (HD0, 3 ) /boot/grub/Menu.conf (note, "GRUB>" is a prompt of GRUB, and the content is written on one line.) 4. The Boot information process of obtaining the GRUB is as follows: DD if = / dev / hda4 of = / Grub.lnx BS = 512 count = 1 This to get the guidance information of GRUB, just use NT Loader to load it. 5. Grub.lnx gets above GRUB.Lnx can first put GRUB first in Windows C-plate root directory .lnx makes it on the floppy disk, then starts Windows, copy to C :; case Allow to copy it directly under Linux to C: The C disk (ie, device / dev / hda1) is FAT32, you can directly from Linux Get it. As follows: mount -t vfat / dev / hda1 / mnt / c cp /grub.LNX / MNT / C umount / mnt / c 6. Modify NT LOA DER's Boot.ini joined a line: c: grub.lnx = "redhat Linux - grub" After joining Boot.ini content is as follows: [Boot loader] Timeout = 15 default = C: boot.lnx [Operating Systems] Multi (0) RDisk (0) partition (1) Windows = "Microsoft Windows XP Professional" / FastDetect [VGA Mode] "/ BaseVideo / Sos C: grub.lnx =" Redhat Linux - Grub "OK. Can be used NT loader loads Linux, in fact, the above process is basically the same as NT Loader loading Lilo. The basic idea is to load LILO or GRUB boot area with NT Loader, where the key is the boot area of Lilo or GRUB. Get. (6) Grub's interactive function with GRUB has powerful interaction. Learn to make you benefit! 1.grub does not display menu? When boot, enter the GRUB interface but no menu, only left Next GRUB> prompt, how to start? Don't worry, look at: grub> cat (hd0, 6) /boot/grub/grub.conf (for watching parameters) GRUB> root (hd0, 6) GRUB> KERNEL ( HD0, 6) /VMLINUZ-2.4.18-14 RO root = label = / grub>