CentOS 6.5 fixed grub boot

Source: Internet
Author: User

CentOS 6.5 fixed grub boot

In the process of using Linux, it is inevitable that the system prompts grub> and cannot be started, which may be caused by the loss of/boot/grub files in the system, when this problem occurs, as long as the system partition is not formatted, it can be fixed. The following uses a virtual machine as an example to delete the/boot partition and fix it again in linux rescue mode: the system used in this experiment is CentOS 6.5 x86_641. Deleting the boot partition will cause grub and linu kernel loss, and then restart:


After the system is restarted, it cannot be started again, as shown below:

2. boot the system with a CD image and select rescue mode to start:

The following message is displayed: mount the system to/mnt/sysimage:

2. Switch the root to the previous system:

3. Create a CD Mount directory and attach the CD:

4. Install the kerner package and generate the/boo directory and kernel and initramfs.

5. To fix grub, first check your disk partition to confirm that grub is installed on that disk:

Install grub boot for the first disk:

6. Check that the geub directory has been generated:

At this time, the system still cannot start normally, because the grub. conf file is confirmed, you can try to restart and check the interface:

5. Specify the path where the kernel and initramfs are located on the grub interface to start. The commands that can be operated include: grub> kernel File // set the path of the kernel file grub> initrd image file name // set the image path grub> boot // start the specified operating system grub> help // get help grub> reboot // restart the system grub> md5-crypt // generate the MD5 ciphertext grub of the password> setup (hdx [, y]) // install GURB to the guidance sector of the MBR/specified partition grub> hide partition // hide the partition grub> cat file name // display the file content grub> find file name // find the file grub> rootnoveify (hdx, y) // set the partition corresponding to the root device, but do not check the loading point grub> chainloader file name // load the specified file. Specify the path of the linux kernel and initramfs file here and start the linux system:

Note: grub> root (hd0, 1) # Is to say with the partition in the first disk of the second partition grub> kernel/boot/vmlinuz-2.6.32-431.el6.x86_64 ro root =/dev/sda2 # specify the kernel path and root partition grub> initrd/boot /initramfs-2.6.32-431.el6.x86_64.img # specify the initramfs path to start the system load driver grub> boot # Start the above specified system, if reboot is used, the entire system is restarted. The setting just now becomes invalid. Now the system can be started, but grub is not available. conf file, you can compile a grub after the system is started. conf file.

6. Compile grub. conf file: You can see that the system does not have grub. conf file. If the system is restarted, it will not be able to boot normally, unless the path of the kernel and driver file is specified on the grub interface:

Create the grub. conf file:

Note: root =/dev/sda2 after a line of kernel refers to the disk where the root partition is located. If the boot partition and the root partition are not together, grub. the conf file should specify the boot partition and root partition. In addition, it is not recommended to install the disk partition to write the path of the root partition, because the disk may change after the system restarts, therefore, we recommend that you use UUID to indicate that each partition has its own UUID, which is the unique ID in the system. You can use the command blkid/dev/sda2 to obtain the UUID. 7. restart the system and start the test on the hard disk;



The system has been started normally!

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.