Restoration notes for grub in Ubuntu and windows

Source: Internet
Author: User
    • Grub is used for releases earlier than Ubuntu 9.10. The restoration method is as follows:
      (Refer


      Http://www.cnblogs.com/nniixl/archive/2008/05/10/1191562.html

      )


Start with Ubuntu livecd, open terminal, and enter:

sudo su
grub

at the grub> prompt, enter:

root (hdx, y)
setup (hdx)

where HD represents the hard disk in the format of (HD hard disk number, Partition Number)
both the hard disk number and Partition Number start from scratch. So (hd0, 0) indicates the first hard disk's 1st partitions, (hd0, 1) indicates the first hard disk's 2nd partitions, (hd1, 4) 2nd partitions of 5th hard disks.

Root (hdx, Y)
Here (hdx, Y) is the partition of the/boot directory
(NormallyUbuntu
The partition where the root directory of the system is located. If/boot is separately separated during installation, you need to set it to the partition where/boot is located .)
If you do not knowUbuntu
Run the commandFdisk-L/dev/SD *
View the current hard disk partition. (Note that-L is lower-case l rather than 1
)

Enter
Quit

Exit grub and restart.

 


 

    • Ubuntu 9.10 and Ubuntu 10.04 use grub2. The methods for restoring grub2 are as follows:

Start with Ubuntu livecd, open terminal, and enter:Sudo-ISwitch to root permission,

Then run the commandFdisk-L/dev/SD *
View the current hard disk partition. For example, sda8 is the partition where the Ubuntu root directory is located, and sda5 is the partition where the boot is located, and then execute:



 

Mount/dev/sda8/mnt

Mount/dev/sda5/mnt/boot
(This step is especially important. I failed to perform it several times because I didn't perform this step)

 




Grub-install -- root-directory =/mnt // DEV/SDA

 

 

 

 

When you see installation finished. no error reported indicates that the operation is successful, but the restart can only boot into Ubuntu, but not the windows after the reinstallation, because the information of the previous Windows version recorded by grub. Therefore, restart Ubuntu,
Open the terminal:

First install grub2 and grub-PC, that isSudo apt-Get install grub2 grub-PC

 

Then recreate the grub list.Sudo update-grub2

Re-write to the first partition MBRSudo grub-install/dev/SDA

To modify the startup sequence, you can modify the grub. cfg file in the/boot/GRUB directory. Note that this file cannot be written. Run the command first.

Sudo chmod + w/boot/GRUB/grub. cfg

Then run sudo gedit/boot/GRUB/grub. cfg to modify it, similar to the menu. lst modification of grub 1.

 

 

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.