Grub boot error solving instance

Source: Internet
Author: User

Grub boot error solving instance

I have two hard disks on my computer, one solid state drive (sda) is installed with win7, and the other general hard drive (sdb) is installed with Ubuntu and CentOS systems, the system boot guide is ubuntu's grub2 installed on sdb. It is responsible for selecting different operating systems to start. OK, the background is complete, and then we will start to talk about our problems.

A new partition was added to the sdb last night, as shown below:

Disk/dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1*512 = 512 bytes
Sector size (logical/physical): 512 bytes/4096 bytes
I/O size (minimum/optimal): 4096 bytes/4096 bytes
Disk identifier: 0xa887a887

Device Boot Start End Blocks Id System
/Dev/sdb1 2048 125829119 62913536 83 Linux
/Dev/sdb2 125829246 970502711 422336733 f W95 Ext 'd (LBA)
Partition 2 does not start on physical sector boundary.
/Dev/sdb5 125829248 221983352 48077052 + 7 HPFS/NTFS/exFAT
/Dev/sdb6 221983424 228274807 3145692 B W95 FAT32
/Dev/sdb7 228274872 518603944 145164536 + 7 HPFS/NTFS/exFAT
/Dev/sdb8 518604008 782021941 131708967 7 HPFS/NTFS/exFAT
/Dev/sdb9 782024704 918054911 68015104 83 Linux
/Dev/sdb10 918056960 934834175 8388608 83 Linux
/Dev/sdb11 934836224 951613439 8388608 83 Linux
/Dev/sdb12 951615488 960004095 4194304 82 Linux swap/Solaris
/Dev/sdb13 960004159 970502711 5249276 + 83 Linux
Partition 13 does not start on physical sector boundary.

Among them, the 13-row sdb6 is the newly added partition. Because this partition is added in the middle of the disk, all the subsequent partition numbers have changed (for example, the root directory of centos was originally installed in sdb8, now it's sdb9). My ubuntu root directory is installed in sdb1. As its partition number has not changed, the ubuntu system can be started normally, the centos system cannot be started!

If I cannot start grub2, I have to troubleshoot the error. At the beginning, I thought it was a boot problem. So I called the update-grub command under ubuntu to update the startup entry of grub2, the update result is as follows:

Generating grub configuration file...
Found background image: ubuntu_kylin_grub_bg.tga
Found linux image:/boot/vmlinuz-3.13.0-46-generic
Found initrd image:/boot/initrd. img-3.13.0-46-generic
Found linux image:/boot/vmlinuz-3.13.0-32-generic
Found initrd image:/boot/initrd. img-3.13.0-32-generic
Found memtest86 + image:/boot/memtest86 +. elf
Found memtest86 + image:/boot/memtest86 +. bin
Found Windows 7 (loader) on/dev/sda1
Found CentOS release 6.6 (Final) on/dev/sdb9
Done

We can see from the above that all three operating systems have been found. Now it should be able to start normally. I restarted and tried again, And centos still failed to start ....

Later, I was wondering if the home Directory and var directory of my centos system were separate partitions and whether they had problems with automatic mounting when it was started, so I went to modify the/etc/fstab file of centos. I used a partition number to identify the partition (for example,/dev/sdb9 ), here I changed all to use UUID to identify the partition. Here, I also learned a little trick. The UUID numbers in the original partition are saved under the/dev/disk/by-uuid/directory, and all soft links are saved, ll, You can see which disk it points to, as shown below:

After I changed the fstab, I restarted the system and found that the problem still failed. I am very depressed. I have been wondering where the problem is? Later, I looked at the grub2 configuration file (grub. cfg) and finally found that the problem was still on the startup Command, as shown below:

Menuentry 'centos release 6.6 (Final) (on/dev/sdb9) '-- class gnu-linux -- class gnu -- class OS $ menuentry_id_option' osprober-gnulinux-simple-d24c3228-5ffc-4937-8411-a69681c3b54e '{
Insmod part_msdos
Insmod ext2
Set root = 'hd1, msdos9'
If [x $ feature_platform_search_hint = xy]; then
Search -- no-floppy -- fs-uuid -- set = root -- hint-bios = hd1, msdos9 -- hint-efi = hd1, msdos9 -- hint-baremetal = ahci1, msdos9 d24c3228-5ffc-4937-8411-a69681c3b54e
Else
Search -- no-floppy -- fs-uuid -- set = root d24c3228-5ffc-4937-8411-a69681c3b54e fi
Linux/boot/vmlinuz-2.6.32-504.12.2.el6.i686 ro root =/dev/sdb8 rd_NO_LUKS rd_NO_LVM LANG = en_US.UTF-8 rd_NO_MD SYSFONT = latarcyrheb-sun16 crashkernel = 128 m keyboardtype = pc KEYTABLE = us rd_NO_DM rhgb quiet vga = 791
Initrd/boot/initramfs-2.6.32-504.12.2.el6.i686.img
}

This is grub. in the cfg file, for the centos startup part, when the linux Command in the ninth line is completed and the kernel is mounted with a read-only command, the selected partition is sdb8, at this time, sdb8 has become the ntfs partition of windows, so when my system is started, it will prompt a large string of unrecognized file system types (ntfs ), just change this to sdb9, and my system will be able to start normally!

^ O ^

After I started it, I was not happy yet. I found that the grub. cfg file was overwritten by running the update-grub command again under ubuntu .. No way. You have to continue the analysis!

After analysis, it is found that the Start entry of centos is by/etc/grub. the configuration file d/30_os-prober is generated. In this file, the linux-boot-prober command finally generates grub. the partition name that follows the root command in the 9th line in the cfg file! The linux-boot-prober command is used to find a partition name similar to "menu. lst "configuration file, I finally found that the problem still lies in the centos system configuration file, as shown below:

Title CentOS (2.6.32-504.12.2.el6.i686)
Root (hd0, 9)
Kernel/boot/vmlinuz-2.6.32-504.12.2.el6.i686 ro root =/dev/sdb8 rd_NO_LUKS rd_NO_LVM LANG = en_US.UTF-8 rd_NO_MD SYSFONT = latarcyrheb-sun16 crashkernel = 128 m keyboardtype = pc KEYTABLE = us rd_NO_DM rhgb quiet vga = 791
Initrd/boot/initramfs-2.6.32-504.12.2.el6.i686.img

In the past, I only changed the partition selected by the root command in line 2nd, but did not change the partition selected by the root command in line 3. As a result, my system still cannot be started ..

OK. After changing the centos configuration file, the problem is finally solved! ^. ^

How to reinstall or fix Grub2 boot in Ubuntu12.04/12.10

Grub and mbr during Linux boot

Installation and Use of grub

Grub Bootstrap Configuration File Analysis

CentOS 6.4 grub and password

CentOS GRUB boot error cannot enter system solution

This article permanently updates the link address:

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.