CentOS grub repair

Source: Internet
Author: User

The full name of grub is GRand uniied Bootloader. Its core function is to guide the kernel. However, if grub has a problem and the kernel cannot be found, it will not be doomed, the following describes common repair methods. For more information about what grub is and what is enabled in the system, see http://essun.blog.51cto.com/721033/1366045

First case:

It is because the grub. conf file in grub is corrupted. After the instance is started, it enters grub> command line mode. The process is illustrated below

In this case, you can use help to check the commands supported by grub for restoration.

The second command is "find (hd0, 0)"/press "tab". If it can be completed, the system is on this partition.

Parameters:

Note that when you specify the kernel, but do not specify the parameter after the kernel (ro root = (not specified here), it will not start properly. Report: Please give the root parameter, in general, the system can automatically detect this function, but this function is not reliable, so you can only rely on backup or your memory to add parameters (so regularly back up/etc/fstab, and grub. conf, how important it is, because you know .)

For example:

At this moment, we can see that you are used to it. Backup is very important.

After logging on to the system normally, you can re-write the grub. conf file. (The complete path is root =/dev/mapper/vg_www-lv_root, write all can not see, so in this special note)

See the title.

The following figure shows that the system can be started normally.

The first case is solved successfully! A_c

Case 2:

Grub corruption (the most obvious prompt is: Operating System not found)

For example, if the mbr data is damaged (only bootloader is damaged and the partition table is good), it may be repaired if it is not restarted, but grub is damaged after restart, you can only attach a CD to the emergency rescue mode. (CD mounting instructions are as follows)

Why is the execution of dd amazing? a_c

Mount the disc to emergency rescue mode and set the disc as the first boot device in the BIOS.

Select "Rescue installed system"

Then you will set the keyboard for language ----

Whether to enable the network (No if not required). If Yes is selected, You must select the IP address retrieval method)

Officially enters rescue mode

How to switch to the original system

Start a shell

Switch to original system

At this time, you can directly enter the grub command into grub (this grub is in the CD)

Using help setup directly shows how to use setup.

Set root (Default root partition), such as (hd0, 0). This partition must be the system partition where root is located, and then install it using setup. The command is setup (hd0) (Since mbr is a partition, you can install grub on the hd0 device.) If it is successful, a prompt is displayed. Quit.

Restart the system and retrieve the disc. If the following information is displayed, the restoration is completed.

If the grub directory is damaged, it cannot be started normally. In this mode, you can use grub-install -- root-directory = // dev/sda (whatever the device is) to hand-Write the configuration file grub. conf.

Summary:

The above tests are performed on virtual machines, which may be different from the actual production environment. Through this test, we further understand the working principle of bootloader. Lay the foundation for future learning.

========================================================== = End ======================================================== ======

PS:

"You cannot give the world to the person you despise, young man. Please work hard !!!! "

Related Article

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.