Boot Loader:grub Getting started [go]

Source: Internet
Author: User

Boot Loader:grub

After reading the entire start-up process and the core module, you should find that the "boot loader is an important tool for loading the core"! There is no boot loader words, then kernel there is no way to be loaded by the system! So, we'll talk about boot loader first, and then talk about the most mainstream grub boot loader in Linux at this stage!

boot loader two stages

We said in the first section where we started the process, after the BIOS read the information, the next step is to go to the first boot device MBR to read the boot loader. This boot loader can have menu function, directly load the core file and control handover function, etc., the system must have loader to be able to load the core of the operating system is. But we all know that the MBR is the first sector of the entire hard disk, a chunk, at best, the entire size is only 446 bytes. Our loader function is so strong, the program code and configuration data can not only account for 446 bytes capacity? How do I install it?

To solve this problem, Linux runs the boot loader code runtime and configuration value load into two stages (stage) to run:

    • Stage 1: Run the boot loader main program:
      The first stage is the main program running boot loader, which must be installed in ScanDisk, i.e. MBR or boot sector. However, as mentioned earlier, because the MBR is too small, the MBR or boot sector usually installs only the minimum main program of the boot loader, and does not have the relevant configuration files installed loader;

    • Stage 2: Main program Load configuration file:
      The second stage is to load all profiles and related environment parameter files (including file system definition and main configuration file menu.lst) through boot loader, in general, the configuration files are under/boot.

So where are these profiles placed? These grub-related files are placed in/boot/grub, so let's take a look at the files.

 [[email protected] ~]# ls-l/boot/grub-rw-r--r--device.map <==grub device corresponding file (discussed below)-rw-r--r--E 2fs_stage1_5 <==ext2/ext3 file System definition file-rw-r--r--fat_stage1_5 <==fat file System definition profile-rw-r--r--Ffs_stage         1_5 <==ffs file System definition file-RW-------grub.conf <==grub in Red Hat profile-rw-r--r--iso9660_stage1_5 <== Optical Drive File System definition profile-rw-r--r--jfs_stage1_5 <==jfs file system definition files lrwxrwxrwx menu.lst Real menu.lst is the configuration file! -rw-r--r--minix_stage1_5 <==minix file System definition document-rw-r--r--reiserfs_stage1_5 <==reiserfs file System definition document-rw-r--r- -splash.xpm.gz <== The background icon under Grub at startup-rw-r--r--Stage1 <==stage 1 related instructions-rw-r--r--stage         2 Description of the <==stage 2-rw-r--r--ufs2_stage1_5 <==ufs file system definition files-rw-r--r--vstafs_stage1_5 <==VSTAFS file System Definition document-rw-r--r--xfs_stage1_5 <==XFS file System definition document 

From the above instructions you can know that the most important/boot/grub/directory is the configuration file (menu.lst) and the definition of various file systems! After reading this file system definition data, our loader is able to recognize the file system and read the core file in the filesystem. The configuration file name of grub should be menu.lst, but it is defined as/boot/grub.conf in Red Hat. Brother Bird suggest that you still remember menu.lst better Oh!

So from the above file, grub knows the file system is really very much oh! That's why GRUB replaces Lilo, the veteran boot loader! Well, let's see what's configured in the config file!

Grub Configuration file/boot/grub/menu.lst and menu type

Grub is currently the most widely used Linux boot management program, the old Lilo this boot management program is now rare, so this chapter will not let the introduction of Lilo to say. The benefits of grub are quite numerous, including:

    • Recognize and support a large number of file systems, and can use the main program of grub directly in the file system to search for the core file name;
    • When you start, you can "edit and modify the startup configuration item yourself", like Bash's command mode;
    • profiles can be dynamically searched without the need to reinstall grub after the configuration file has been modified. That is, as long as we modify the/boot/grub/menu.lst inside the configuration, the next launch will take effect!

The 3rd above is actually stage 1, Stage 2 is installed in the MBR (main program) and the file system (configuration file and definition file) reason! OK, next, let's get a good look at the grub configuration file:/boot/grub/menu.lst this thing! Be careful, that LST is the lower case of LST, do not mistake!

code for hard disk and split slots in Grub

Installed in the MBR of the GRUB main program, one of the most important tasks is to load the core files from the disk, so that the core can smoothly drive the entire system of hardware. So Luo, grub must know the hard drive! So how did grub know about the hard drive? Hey! Grub's code-to-disk configuration is completely different from the traditional Linux disk code! Grub identifies the hard drive using the following code:

(hd0,0)

That's enough, isn't it? With/dev/hda1 wind horse cow irrelevant ~ How to do ah? In fact, just pay attention to a few things, that is:

    • The hard drive code is wrapped up in parentheses ();
    • Hard drives are expressed in HD, followed by a set of numbers;
    • Use "search Order" as the number of the hard drive, not the sort of hard drive line! (This is important!) )
    • The first hard drive to find is number No. 0, the second is number 1th, and so on;
    • The first partition of each hard drive is codenamed 0, and so on.

So, the first "hard drive to find" code is: "(hd0)", and the first partition of the hard disk slot is "(hd0,0)", so you understand it? Anyway, you have to remember, in grub, the number he started is 0 instead of 1!

On older motherboards, usually the first hard disk will be inserted in the IDE 1 master, it will be/dev/hda, so often we may misunderstand/dev/hda is (hd0), actually not Oh! It depends on your BIOS configuration values! Some motherboard BIOS can adjust the boot drive search order, then pay attention, because GRUB's hard drive code may be changed! Pay attention!

So, the whole drive code is:

Hard Drive search Order The code name in Grub.
First (hd0) (hd0,0) (hd0,1) (hd0,4) ....
Second (HD1) (hd1,0) (hd1,1) (hd1,4) ....
Third (HD2) (hd2,0) (hd2,1) (hd2,4) ....

Is that supposed to look better? The first disk of the MBR installation of the hard disk Code is "(hd0)", and the first disk of the first partition slot of the boot Sector Code is "(hd0,0)" The first hard disk of the first logical split slot boot sector codenamed "(hd0,4)"!

Assuming that your system has only one SATA hard drive, describe the first logical slot of the hard disk in the Linux and grub file name and code:

Because it is a SATA disk, plus the use of a logical partition slot, so the file name in Linux is/dev/sda5 (1~4 reserved for primary and extended use). The code for the disk in grub is only one disk, so the code name will be "(hd0,4)".

/boot/grub/menu.lst configuration file

After knowing the most troublesome hard drive code in grub, let's take a look at the contents of the configuration file. Let's take a look at the/boot/grub/menu.lst in the CentOS:

[[email protected] ~]# vim/boot/grub/menu.lstdefault=0     <== default boot option, use 1th boot menu (title) timeout=5     <== if 5 The keyboard is not moved in seconds, using the default menu to start Splashimage= (hd0,0)/grub/splash.xpm.gz <== the file in which the background icon is located hiddenmenu    <== The Full menu screen is displayed during read seconds (default hidden Title CentOS (2.6.18-92.el5)    <== first menu content        root (hd0,0)        kernel/vmlinuz-2.6.18-92.el5 ro root=label=/1 RHGB quiet        initrd/initrd-2.6.18-92.el5.img

In the previous four lines, it is the overall configuration of grub, including the default wait time and default startup items, as well as the display features and so on. At the end of the title is the specified startup core file or boot loader control. The most common items in the overall configuration are:

  • Default=0
    This must be compared with the title, in the configuration file there are several title, when you start there will be a few menus to choose from. Since the grub start number is No. 0, default=0 represents the start with the "first title item". Default means that if you do not move to the keyboard before the end of the second reading time, grub defaults to using this title item (number No. 0) to start.

  • Timeout=5
    Read seconds on startup, and if you don't press any keys within 5 seconds, you'll start by using the title item mentioned above for default. If you think 5 seconds is too short, you can turn this value up (for example, 30 seconds). In addition, if the TIMEOUT=0 representative directly uses the default value to start without reading the second, Timeout=-1 represents the direct entry menu without reading the second!

  • Splashimage= (hd0,0)/grub/splash.xpm.gz
    Did you find that your CentOS background is not black-and-white but color-changing when it starts? That's the background icon for this file (Note 3)! But how can the actual path of this file be written like this? Very simple AH ~ The above means: in (hd0,0) this slot in the top-level directory, the bottom of the grub/splash.xpm.gz that file meaning. Since brother Bird will be the directory of/DEV/HDA1, so this will be written "in/dev/hda1 inside the grub/splash.xpm.gz" meaning! Think about it, if your/boot directory is not a separate slot, how would you write it?

  • Hiddenmenu
    Does this mean that the menu should be displayed at startup? The current CentOS default is not to display the menu, if you want to display the menu, then the configuration value is commented out!

The overall configuration is probably the case, and the bottom title is the configuration item that shows the startup. As mentioned in the previous section, you can choose (1) directly specify the core file to start or (2) Transfer boot loader control to the next loader (this process is called chain-loader). Each title is followed by the display of the name of the startup item, which is the name on the menu when the menu appears. So what is the difference between the two ways of configuration?

directly specify the core boot

Since you want to specify the core boot, of course to find the core files! In addition, it is possible to use the INITRD RAM Disk configuration file. However, as mentioned earlier, has not been started to complete, so we have to use the Grub hard drive identification method to find the full kernel and INITRD file name. Therefore, we may need to have the bottom way to configure the line!

1. First specify the core file to place the partition, then read the file (directory tree), and   finally add the actual file name and path (kernel and INITRD); the   bird's/boot is/dev/hda1, so the configuration of the core file becomes: root    (hd0,0)          <== on behalf of the core file in that partition kernel  /vmlinuz-2.6.18-92.el5 ro root=label=/1 rhgb quietinitrd  /initrd-2.6.18-92.el5.img

Above root, kernel, initrd the meaning of the parameters after the following is explained as follows:

Root: Represents the "Partition, not the root" of the "core file" Oh! Don't make a mistake! In the case of Brother Bird, my root directory is/dev/hda2 and/boot Independent for/DEV/HDA1, because it is related to/boot, so the disk code will become (hd0,0) ROM.

Kernel: The core file name is followed by the kernel, and the core parameter is followed by the file name. Because of the need to mount the root directory during the boot process, the ROOT=LABEL=/1 behind kernel refers to the meaning of "the root directory of Linux in which partition".

The LABEL is used here to mount the root directory. As for the RHGB color display and quiet is quiet mode (the screen does not output the core detection information).

INITRD: That's the file name of the INITRD that made the RAM Disk in the previous paragraph!

2. Directly specify partition and file name, do not need to specify the core file where the device code kernel  (hd0,0)/vmlinuz-2.6.18-92.el5 ro root=label=/1 rhgb quietinitrd  (hd0,0)/initrd-2.6.18-92.el5.img

To be honest, Brother Bird prefers this style of file name writing, because then we can know the name of the device in which the core file is, and not think of our root directory (/, root)! Let's think about the case of/boot with separate segmentation and no independent segmentation!

My system partition is:/DEV/HDA1 (/),/dev/hda2 (Swap), and my core file is/boot/vmlinuz, how to write the core file location in Grub Menu.lst?

Let's take a look at the iterative way of doing it. Due to the core file name/boot/vmlinuz, the transfer to the device file name and code will become the following process: Original file:  /boot/vmlinuz↓linux device: (/dev/hda1)/boot/vmlinuz↓grub  device: ( hd0,0)/boot/vmlinuz So the final kernel will become: Kernel (hd0,0)/boot/vmlinuz root=/dev/hda1 ...

Ditto, just my segmentation becomes:/dev/sda1 (/boot),/DEV/SDA5 (/)?

Because/boot is independent, so the situation will be different Oh! As follows: Original file:  /boot/vmlinuz↓linux device: (/dev/sda1)/vmlinuz↓grub  device: (hd0,0)/vmlinuz so the final kernel notation will become: kernel ( hd0,0)/vmlinuz Root=/dev/sda5 ...

Transfer of control by means of chain loader

The so-called chain loader (the link to start the hypervisor) is just handing control over to the next boot loader, so grub doesn't need to know and find the kernel file name, " He just handed the boot control to the next boot sec Boot loader in Tor or MBR "so usually he doesn't need to check the next boot loader filesystem!

In general, chain loader configuration as long as two, one is expected to go to the location of the boot sector slot code, and the other is the configuration chainloader in that slot of the boot sector (the first magnetic region)! Assuming that my Windows split slot is in/DEV/HDA1 and I have only one hard drive, grub will give control to Windows loader as long as this is enough:

[Email protected] ~]# vi/boot/grub/menu.lst .... The title Windows partition    root (hd0,0)    <== configuration uses this split slot    chainloader +1  <== +1 can be thought of as the first magnetic region, that is, the boot Sector

In the example above, we can simply think of that (hd0,0) is the disk of Windows C slot, and Chainloader +1 is to let the system load the partition slot in the first magnetic region (that is, the boot sector) within the boot management program. However, the boot disk of Windows needs to be configured to activate (active) state, and our grub defaults to verify the file system for that slot. So we can rewrite the above example into this:

[Email protected] ~]# vi/boot/grub/menu.lst .... Pre-.... title Windows partition    rootnoverify (hd0,0)   <== does not verify this split slot    chainloader +1    makeactive             <== Configure this split slot for boot disk (active)

Grub also features more than this, and he is able to hide some of the split slots. For example, my/dev/hda5 is to install a partition slot for Linux, and I don't want Windows to recognize this partition slot when you can:

[Email protected] ~]# vi/boot/grub/menu.lst .... Before .... title Windows partition    Hide (hd0,4)           <== hidden (hd0,4) This split slot    rootnoverify (hd0,0)    Chainloader +1    makeactive

the importance of INITRD and creating a new Initrd file

Initrd this thing, his purpose is to provide the most important core modules needed during the boot process, so that the system startup process can be completed smoothly. The reason for this will be INITRD because the core modules are placed in/lib/modules/$ (UNAME-R)/kernel/, which must be read only when the root directory (/) is mounted. However, if the core itself does not have the driver of the disk, of course, can not mount the root directory, there is no way to get the driver, thus creating a dilemma.

INITRD can be/lib/modules/.... Within the "boot process must be required module" package into a file (file name is INITRD), and then at boot time through the host's INT 13 hardware function to extract the file to decompress, and INITRD in memory will be simulated as the root directory, because of this virtual file system (Initial RAM Di SK) mainly contains disk and file system modules, so our core can finally know the actual disk, then we can carry out the actual root directory of the mount! So said: "Themodule contained in the INITRD is mostly related to the start-up process, and the main file system and hard disk modules (such as USB, SCSI, etc.) mainly"!

In general, the time required for INITRD is:

    • The root directory is a SATA, USB flash drive, or SCSI connection interface;
    • The root directory is located in the file system for LVM, RAID and other special formats;
    • When the root directory resides in a file system that is not known to traditional Linux;
    • Other modules that must be provided at core load time.

In general, the core provided by each distribution is attached to the Initrd file, but if you have special needs so you want to re-initrd files, you can use the MKINITRD to deal with. This file is handled in a very simple way, man MKINITRD will know! ^_^. Let's simply introduce it!

[[email protected] ~]# MKINITRD [-v] [--with= module name] INITRD file core version options and parameters:-V: Shows the operation of MKINITRD--with= Module Name: module name refers to the name of the module, do not need to fill in the file name. For example, the current core version of the Ext3 file system module is the following file name:/lib/modules/$ (uname-r)/kernel/fs/ext3/ext3.ko then you should write:--with=ext3. (Omit. ko) initrd file name: The name of the INITRD file you want to create, try to make a meaningful and well-remembered one. Core version: A core version, if the current core is "$ (uname-r)" Example one: Create a initrd Virtual disk file with mkinitrd default function [[email protected] ~]# mkinitrd-v INI trd_$ (uname-r) $ (uname-r) Creating initramfslooking for Deps of the module ehci-hcdlooking for deps of module OHCI-HCD .... (omitted in the middle) .... Adding Module EHCI-HCD <== The final addition to INITRD is the bottom block Adding modules ohci-hcdadding Module uhci-hcdadding module jbdadding modu  Le ext3adding module scsi_modadding module sd_modadding Module libataadding module pata_sis[[email protected] ~]# ll INITRD_*-RW-------1 root root 2406443 Apr 02:55 initrd_2.6.18-92.el5# since the current core version is available in uname-r, so brother Bird uses a simpler command to handle Luo ~# at this time INITRD will be created and you can move him to/boot for use. Example two: Add 8139too initrd file for this module [[Email protEcted] ~]# mkinitrd-v--with=8139too initrd_vbirdtest $ (uname-r) .... (omitted earlier) .... Adding Module miiadding module 8139too <== See! So join in!

Once the INITRD is created and the core is finished, we can use GRUB to create the menu! Keep a look at the bottom!

testing and installing Grub

If your Linux host is using grub as a loader, then you don't need to reinstall GRUB, because grub would have volunteered to read the config file! You say yes! But if your Linux original is not grub, then you need to install it! How to install it? First, you have to use Grub-install to copy some necessary files into the/boot/grub, which you should do:

[[email protected] ~]# grub-install [--root-directory=dir] install_device options and parameters:--root-directory=dir that DIR For the actual directory, using Grub-install defaults to copy all of the grub files to/boot/grub/*, which is used if you want to copy to another directory and device. Install_device Installed device Code! Example one: Install grub under the MBR of the current system, my system is/dev/hda:[[email protected] ~]# grub-install/dev/hda# because originally/dev/hda is using grub, so it seems There is no special information. # If you look up the contents of/boot/grub, you will find that all the files have been upgraded because we re-installed! Example two: my/home for standalone/dev/hda3, how to install grub to/DEV/HDA3 (boot sector) [[email protected] ~]# grub-install--root-directory= /home/dev/hda3probing devices to guess BIOS drives. This could take a long time. Installation finished. No Error reported. This was the contents of the device Map/home/boot/grub/device.map.check if this was correct or not. If any of the lines is incorrect,fix it and re-run the script ' Grub-install '. (fd0)/dev/fd0 (hd0)/dev/hda <== will give the device code corresponding table!    [[email protected] ~]# ll/home/boot/grub/-rw-r--r--1 root root-11:12 device.map-rw-r--r--1 root root 7584 APR 11:12 e2fs_stage1_5 .... (omitted below) .... # Look! The files are all installed in! But notice that we don't have a profile! You have to create it yourself!

So, Grub-install is to install grub-related files (such as file system definitions) on your device to wait for it to be read at startup, but also configure the configuration file (Menu.lst), and then install the GRUB main program to MBR with the grub shell or the boot sector! Well, let's think about the data you want to install.

I expect the menu to be displayed directly at startup, with the menu countdown to 30 seconds. In addition, in the original Menu.lst three new launch menu, respectively, the following description:
    1. Assuming that the/DEV/HDA1 contains boot loader, how does this loader gain control?
    2. How do I re-read the loader inside the MBR?
    3. Use your original system core file to create a menu that forces you into single-player maintenance mode

The 1th is simple, just use the instructions from the previous section to handle it. As for the 2nd, the MBR reads the first magnetic region of the entire hard disk, so root (hd0) is the right one. The 3rd is related to the core follow-up parameters. The entire file can be rewritten like this:

[Email protected] ~]# vim/boot/grub/menu.lstdefault=0timeout=30splashimage= (hd0,0)/grub/splash.xpm.gz# Hiddenmenutitle CentOS (2.6.18-92.el5)        root (hd0,0)        kernel/vmlinuz-2.6.18-92.el5 ro root=label=/1 rhgb quiet< C2/>INITRD/INITRD-2.6.18-92.EL5.IMGTITLE/DEV/HDA1 Boot Sector  <== The first new menu        root (hd0,0)        in this example Chainloader +1title MBR Loader             <== New second menu        root (hd0)           <==mbr is the first magnetic region of the entire disk, so use the code        of the entire disk Chainloader +1title Single user mode       <== new Third menu (actually copied from the original title)        root (hd0,0)        kernel/ Vmlinuz-2.6.18-92.el5 ro root=label=/1 rhgb quiet single        initrd/initrd-2.6.18-92.el5.img

The next time you start, you'll find four menus to choose from, and the default is to start with the first menu!

We have finished processing the profile, but what you need to know is that we don't know if/DEV/HDA1 has the GRUB main program, so we want to install the GRUB main program again to the/DEV/HDA1 boot sector, and also want to reinstall Grub to M BR above go. At this point we have to use GRUB Shell ROM! The entire installation and the Grub shell action is very simple, if you are interested in research, you can use info grub to consult ~ Bird Brother here only a few useful commands.

    • Use "root (hdx,x)" To select the partition code containing the GRUB directory;
    • Use "Find/boot/grub/stage1" to see if you can find the installation information file;
    • Use "Find/boot/vmlinuz" to see if you can find kernel file (not necessarily successful!). );
    • Install grub in boot sector or MBR with Setup (hdx,x) or setup (HDX);
    • Use "Quit" to leave the grub shell!

It's the stage1 that we need to install most! That is the main program of GRUB! And the configuration file is usually placed in the same directory as the main program. So we need to use root (hd0,0) to find/boot/grub/stage1 Oh! Next, please use GRUB to enter the GRUB shell! After entering grub, a "grub>" hint byte will appear!

[[email protected] ~]# grub# 1. Configure the partition that contains the GRUB directory first! grub> root (hd0,0) Filesystem type is EXT2FS, partition type 0x83# The division of the host,/boot/grub in/boot split slot, that is/dev/hda1 inside Oh! In addition, GRUB is able to distinguish the file system (EXT2) of the split slot. # 2. Search, is there stage1 this information file? Grub> Find/boot/grub/stage1 (hd0,2) # Damn it! How can there be only one! We obviously have/boot/grub and/home/boot/grub Ah! # because the/boot is independent, so to find the file name you have to use the following way:grub> Find/grub/stage1 (hd0,0) # so you can find ROM! Pay special attention to grub finding not the directory tree, but the files inside the appliance. # 3. Find out if the core can be found? /boot/vmlinuz-2.6.18-92.el5? Grub> find/boot/vmlinuz-2.6.18-92.el5error 15:file not foundgrub> Find/vmlinuz-2.6.18-92.el5 (hd0,0) # Re-emphasize that because/b Oot/is independent, so it will become the top of the appearance of Luo! # 4. Install the main program up! Install to MBR look! grub> Setup (hd0) Checking if "/boot/grub/stage1" exists ... no <== because/boot is a standalone Checking if "/grub/stage1" exists. . Yes <== so this file name is right! Checking if "/grub/stage2" exists ... yes Checking if "/grub/e2fs_stage1_5" exists ... yes Running "embed/grub/e2fs_stage1_  5 (hd0) "... Sectors is embedded.succeeded Running "install/grub/stage1 (hd0) (hd0) 1+15 P (hd0,0)/grub/stage2/grub/grub.conf "... succeeded <== install stage1 program properly! done.# very good! It's really loaded up ~ So grub is in the MBR! # 5. What about repeating the installation to my/dev/hda1? Which is the boot sector? grub> Setup (hd0,0) Checking if "/boot/grub/stage1" exists ... no Checking if "/grub/stage1" exists ... yes Checking if " /grub/stage2 "exists ... yes Checking if"/grub/e2fs_stage1_5 "exists ... yes Running" embed/grub/e2fs_stage1_5 (hd0,0) "... . Failed (this was not fatal) Running "Embed/grub/e2fs_stage1_5 (hd0,0)" ... failed (this is not fatal) Running "Install/gru  B/stage1 (hd0,0)/grub/stage2 p/grub/grub.conf "... succeededdone.# although it is not possible to install stage1_5 to boot sector, there is no problem, but the point is the last one. Stage1 to install, display succeeded words on it! Grub> quit

As a result, grub has been installed into the boot sector of the MBR and/DEV/HDA1! And reading is (hd0,0) inside of the/grub/menu.lst that file Oh! It's really important! Important To Not!

Finally, summarize:

    1. If you are transferring from another boot loader to grub, you must first install the Grub configuration file using Grub-install;
    2. Start editing Menu.lst this important configuration file;
    3. Install the main program into the system through grub, such as the MBR (hd0) or boot sector (hd0,0), and so on.

additional feature modifications prior to startup

In fact, after the previous section has been configured, your grub is already on your Linux system, and it exists in both the MBR and boot sector! So, we can already reboot to check it out! In addition, if you are starting up, then please note that we can press any key in the default menu (30 seconds in the case of bird brother), and also do the "online editing" function of Grub! That's great! Let's take a look at the splash screen!

Since brother Bird has canceled the function of the hidden menu, you will see the four menus directly, and will have the countdown of the second reading. The menu part of the screen is actually the text behind the title! You now know how to modify the text behind the title! ^_^. If you use the up and down keys to select the second (/dev/hda1 boot sector) or third (MBR loader), you will find the same picture repeated! That's because the two are loader handed over! And we all use the same grub with the same menu.lst config file! So this picture will repeat itself! How do you know that?

In addition, if you look closely, you will find there are some details of the bottom of the options, there seems to be an ' e ' edit look! Yes ~ Grub supports online editing commands Oh! This is a very useful feature! If you have just written the contents of the menu.lst incorrectly, resulting in a problem that cannot be started, we can check the contents of the title menu and modify it! For example, I want to know the actual contents of the first menu, move the anti-white bar to the first menu, and then press ' E ' to enter the following screen:

Ha ha! Isn't that what we're configuring in Menu.lst? That's right! At this point you can continue to further modify Oh! Notice the bottom of the instructions, you can also use:

    • E: Enter the edit screen of the grub shell;
    • O: Add another line underneath the cursor line;
    • D: Delete the line where the cursor is located.

As we said, grub can be started directly using the core file, so if you know exactly where your root directory (/) is in that partition, and know your core file name (usually with a/boot/vmlinuz link to the correct file name), Then directly in the might screen, with the above O, D, e three keys to the editing, become similar to the following:

Press the [Enter] button, then enter B to boot, you can start! So, in case your/boot/grub/menu.lst configuration is wrong, or because of the installation, or because of the core file, which causes it to fail to start smoothly, remember, you can use the Grub Shell to query (find) In the Grub menu section. or directly specify the core file, you can start! ^_^

In addition, many times our grub may be wrong, causing "even grub can not boot", then you can not use Grub's online editing function! What to do? It's okay! We can start by using a CD with Grub boot, and then to the CD's grub on the line editing, hey! You can also use the core files above the hard disk to start up! It's fun! ^_^

Transfer from http://vbird.dic.ksu.edu.tw/linux_basic/0510osloader_3.php

Boot Loader:grub Getting started [go]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.