[Switch] grub rescue Repair Method

Source: Internet
Author: User

Symptoms:
Boot display:

GRUB loadingerror:unknow filesystemgrub rescue>

Cause:
The following operations have been found to cause this problem:
1. To delete Debian, delete/format the partition where Debian is located in windows.
2. Adjust the disk and use tools to merge, split, adjust, and delete partitions to change the number of disk partitions.
3. reinstall the system and install Linux to a new partition. The original partition has been formatted, but grub2 has not been re-installed.
4. Use the Debian backup tool or derivative version manufacturing tool to restore the primary partition to the old version of 8. X. As a result, grub of the old version is grub1, and grub2 is destroyed.

Generally, the operator does not know that grub2 is divided into two parts, one part (generally) written on MBR, the other part is written in the/boot/GRUB directory of a partition (if/boot is separately partitioned, it is directly written in the/GRUB directory of the corresponding partition. As a result, the part in the MBR of grub2 cannot find the part in the/GRUB directory (or the part has been deleted ).

Ideas:
Method 1:Delete grub2 permanently so that the prompt does not appear again:
This method is applicable to users who no longer want to use Debian and want to switch back to Windows.
This is very simple, as long as you have a Windows boot disk (not a ghost), use it to start, to select the installation location, do not actually install, exit and restart it.
You can also use it to start to the fault recovery platform and run fixboot or fixmbr.
Run the following command in the win7 command line:

BootRec.exe /fixmbr

(/Fixmbr repair MBR,/fixboot repair startup sector,/scanos detection installed win7,/rebuildbcd reconstruction BCD .)

Method 2:Reinstall and fix grub2
1. Run the LS command to find the partition where Ubuntu is installed:
Run the following command under grub rescue>:

ls

All disk partition information is listed, for example:

Reference:

(Hd0, 1), (hd0, 5), (hd0, 3), (hd0, 2) Note: I am (hd0), (hd0, msdos3 ), (hd0, msdos5)

2. Call the following commands in sequence: X indicates the number of each partition.
If/boot is not partitioned separately, run the following command:

ls (hd0,X)/boot/grub

If/boot is partitioned separately, run the following command:

ls (hd0,X)/grub

3. Under normal circumstances, hundreds of files will be listed. Many files have extensions:. Mod,. lst, And. IMG. Another file is grub. cfg. If the file in the folder is displayed (hd0, 5), it indicates that Linux is installed in this partition.
4. If the correct grub directory is found, try to temporarily associate the two parts of grub as follows:
The following command does not have a separate partition for/boot:

grub rescue>set root=(hd0,5)grub rescue>set prefix=(hd0,5)/boot/grubgrub rescue>insmod /boot/grub/normal.mod

The command for separate partitioning of/boot is as follows: (these statements need to be verified)

grub rescue>set root=(hd0,5)grub rescue>set prefix=(hd0,5)/grubgrub rescue>insmod /grub/normal.mod

Then, call the following command to display the lost GRUB menu.

grub rescue>normal

But don't be happy. If the problem persists during the restart, we need to go to Linux and fix grub.
Start up. After Entering Debian, run the following command on the terminal:

sudo update-grubsudo grub-install /dev/sda

(SDA is your hard disk number. do not specify a partition number, such as sda1 or sda5)
Have the grub Startup Menu been restored? Congratulations! recovery successful!
5. If the correct/GRUB directory cannot be found, for example, 3rd or 4 misoperations, try to find whether the Linux core file exists. Then, call the following command in sequence: X indicates the number of each partition:
Grub rescue>, enter:
If/boot is not partitioned separately:

ls (hd0,X)/boot

If/boot is partitioned separately, then:

ls (hd0,X)

Find a file named like a vmlinuz-3.0.0-12-generic, which is the Linux core file, if found, write down the value of X in (hd0, X. Assume that the files in the folder are displayed when (hd0, 5) is found.
Start with live CD or live USB, and input the following commands in sequence on the Ubuntu terminal of live CD ("5" in sda5 must be changed to the value recorded above) (These two sentences need to be verified ):
If/boot is not partitioned separately:

sudo mount /dev/sda5 /mntsudo grub-install --boot-directory=/mnt/boot /dev/sda

If/boot is partitioned separately, then:

sudo mount /dev/sda5 /mntsudo grub-install --boot-directory=/mnt /dev/sda

Then restart.

(The above two commands can also solve the problem that the grub installation location is incorrect during Debian installation, and grub is not installed in/dev/SDA. As a result, the Debian startup item does not directly go to Windows during startup, however, you need to determine the number of "5" in sda5 .)
6. If you do not have a Linux core file, reinstall it.

[Switch] grub rescue Repair Method

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.