Introduction and usage examples of grub on Linux systems

Source: Internet
Author: User

Grub (grandunified boot Loader) is a well-known boot kernel program (another well-known lilo, embedded environment using U-boot, bootloader), which supports a variety of hard disk partition type loading (FAT,EXT2,EXT3, Ext4,minix,ffs, etc.), support multi-system boot, etc.

1. configuration file:/boot/grub/grub.conf

Configuration items:

        default=#:  Sets the default Start menu item, the entry item (title) number starts at 0;         timeout=#: Specifies the length of time the menu item waits for the option to be selected;         splashimage= (hd#,#)/path/to/xpm_pic_file: Indicates the menu background picture file path;         hiddenmenu: Hide menu;         password  [--md5] STRING:  menu editing certification;         title title: Define menu Items " Title ",  can appear multiple times;        root  (hd#,#): Grub finds Stage2 and kernel files in the same device partition "Root" for grub;          kernel /path/to/vmlinuz_file [ PARAMETERS]: Boot kernel         initrd /PATH/TO/INITRAMFS_FILE:  Kernel-Matched Ramfs files;        password [--md5] string:  Authentication when the selected kernel or operating system is started; 

Description: Grub-md5-crypt command: The password for the password item configuration is ciphertext and can be encrypted with this command

2. Grub Operation Interface

When the system starts bootloader loading the Grub interface, you can press any key on the keyboard to enter the Grub startup page.


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/89/89/wKioL1gXEI7Qq0rQAAD3v2jkh1Q009.jpg "style=" float: none; "title=" g1.jpg "alt=" Wkiol1gxei7qq0rqaad3v2jkh1q009.jpg "/>


E: Edit mode, for editing menus;

C: Command mode, interactive interface;

Enter single-user mode:

Enter single-user mode:

(1) Edit the Grub menu (select the title to edit, then use the e command);

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/89/89/wKioL1gXEJzQ84p4AAGkHsZOm-c938.jpg "title=" g2.jpg "Style=" Float:none; "alt=" wkiol1gxejzq84p4aagkhszom-c938.jpg "/>

(2) attach after selected kernel

1, S, s or single can be;

650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M00/89/8B/wKiom1gXEIvCQhm2AADZhX32TOE056.jpg "title=" 3.jpg " Style= "Float:none;" alt= "wkiom1gxeivcqhm2aadzhx32toe056.jpg"/>

(3) Press ENTER to return to the previous interface, in the kernel line, type "B" command, enter the single-user mode;

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/89/8B/wKiom1gXEZTw5rZGAAEIxpGsysk519.jpg "title=" g4.jpg "alt=" Wkiom1gxeztw5rzgaaeixpgsysk519.jpg "/>

3. Grub Repair

(1) If there is a problem with the Grub configuration file can be written or copied from another version of the system

(2) Entire GRUB recruit to destroy

As follows:

First the GRUB data is destroyed 650) this.width=650; "Src=" http://s4.51cto.com/wyfs02/M01/89/89/wKioL1gXE03znPSPAAB0qewOSzI798.jpg " Title= "G5.jpg" style= "Float:none; alt=" Wkiol1gxe03znpspaab0qewoszi798.jpg "/>

System does not start

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/89/8B/wKiom1gXE02j6kaoAADqRrB_H5I817.jpg "title=" g6.jpg "Style=" Float:none; "alt=" wkiom1gxe02j6kaoaadqrrb_h5i817.jpg "/>

Booting with CD

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/89/8B/wKiom1gXE06yF_JpAAHp1ZeDUc8238.jpg "style=" float: none; "title=" g7.jpg "alt=" Wkiom1gxe06yf_jpaahp1zeduc8238.jpg "/>

Through language selection, disk check, network setup and other operations, go to the shell prompt

Execute the following command:

sh-4.1# chroot/mnt/sysimagesh-4.1# grub-install/dev/sdash-4.1# exitsh-4.1# exit

Then restart the system, you can start the system normally.

Of course, you can also access the damaged grub hard drive to other normal operating systems.

Hang the/boot partition in the/mnt/boot directory,

Perform:

Grub-install--root-directory=/mnt/boot/dev/sda#--root-directory= the directory where/boot is hung,/DEV/SDA is the disk that damaged grub




Introduction and usage examples of grub on Linux systems

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.