Centos 6.5 installation UEFI-GP Boot T rolled back to MBR

Source: Internet
Author: User

I installed centos 6.5 on the server. UEFI is used by default. I didn't pay attention to using GRUB only. Then the problem occurs, I installed another hard disk with grub boot system on the server,

After the hard disk is started, if the hard disk is removed and restarted, The UEFI of centos 6.5 cannot be identified. You can start the UEFI of the motherboard and run the UEFI command:

[Cpp] view plaincopy
  1. Mountfs0
  2. Fs0:
  3. CdEFI
  4. Cdredhat
  5. Grub. efi
The folder name may not be accurate. In this way, you can manually start the system. You can also insert the system disk to upgrade the system. You don't need to manually delete the folder or lose data.

This is not very good. So I had the idea of turning the UEFI-GPT back into MBR.

Google is always awesome, so I got the result of using gdisk. I started another system, mounted the hard disk of centos 6.5, and followed the steps on google:

  • 1
    Click "Applications." Point to "Accessories," then click "Terminal." Input the following into Terminal: sudo fdisk-l
  • 2
    Press "Enter" to see the disk devices connected to the computer. the device with the asterisk next to it is the boot device. write down the filename (for example,/dev/sda) assigned to the disk.
  • 3
    Input the following into Terminal: sudo apt-get install gdisk. Press "Enter" to install the partitioning tool to Ubuntu.
  • 4
    Input "sudo gdisk" into Terminal, then press "Enter" to run gdisk as a superuser. Input the name assigned to the boot device, then press "Enter" again.
  • 5
    Press "r," then hit "Enter," to switch to the recovery and transformation options. press "g," then press "Enter," to select the option to convert GPT to MBR on Linux.
  • 6
    Press "w," then press "Enter," to convert GPT to MBR on the primary partitions. Press "y," then "Enter," to finalize and exit.
After the operation is complete, the system cannot be restarted, and the UEFI manual guide will not work.

When humans think, God will laugh, but after thinking, they will find that they can still be saved,

Note in advance that centos 6.5 is installed in three zones, namely, sda1-UEFI zone, which is fat32, sda2 -- display the partition of the actual system and data that is NTFS (but ext4) under fdisk-l,

Sda3 -- swap partition.

After entering the system started by the USB flash drive, I mounted the sda1 partition to the mnt directory and found that there was a file grub in the efi-> redhat Directory. conf, people who often play the system know what this is. That's why I have hope.

The specific steps are as follows:

1. mount sda1 and copy grub. conf for later use. Do not use it! Then umount

2. Use fdisk to change sda1 to 83-linux, sda2 to 83-linux, and sda1 to startup partition.

[Cpp] view plaincopy
  1. The command process is as follows:
  2. Fdisk/dev/sda
  3. T
  4. 1
  5. 83
  6. T
  7. 2
  8. 83
  9. A
  10. 1
3. Make sda1 into ext3 because it is fat32.

Command: mkfs. ext3/dev/sda1

4. mount sda1 and sda2. Here, sda1 is in/mnt and sda2 is in/sda2. install grub, grub-install -- root-directory =/mnt/dev/sda for sda1, in this way, grub is installed.

5. Copy the backed up grub. copy the conf file to the/mnt/boot/grub directory and make a soft connection. the lst points to grub. conf command: ln-s grub. conf menu. lst

6. Run the/sda2/boot/directory in grub. the files used in conf are used by kernel, and the files used by initrd are copied to the/mnt/boot directory.

7. Modify/mnt/boot/grub. conf and change root (hd0, 1) to root (hd0, 0)

8. Save, sync, umount, unmount the hard disk, and restart.

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.