Restore grub2 from live CD

Source: Internet
Author: User

How to re-install grub 2 from a live CD
Without the need to chroot.

1) boot your Ubuntu karmic koala or later 'desktop 'live CD, or anotherkarmic installation such as an operating system in a USB device orwhateveryou have to use as a rescue disk.

Tip: it will make your Ubuntu life alot easier if you take a few minutes to set a nice user-freindly filesystem label in your Linux file systems,

How to Set File System labels with gparted.

2) the operating system you want to fix needs to be mounted.

Just go 'places' --> 'removable media 'or just 'places' and look under 'computer' For the disk or partition you want to mount and click on it.-Also see
Click-Icon mounting.
Youshoshould see an icon for it on your desktop, but what you may not see isthe 'mount point', which will normally be located in your/mediadirectory. we will need to know the file path and name of the mount point.

3) find the name of the mount point,

Ls/Media

Thefile path that is returned from theabove command will be needed for making up the next command. the nameof the mount point might be a file system label or UUID number. formy example I'll just usethe word 'disk' for short.

4) run the grub-setup command, inserting the-D option and specifying thepath to the/boot/GRUB directory of the operating system you're re tryingto fix,

Sudo grub-setup-D/Media/Disk/boot/GRUB/dev/SDA

The-D option tells grub to use files from the specified directory.
Please substitute the word 'disk' with the name of your own mount point as found in step 3)
The '/dev/SDA' part tells grub-setup to install grub to MBR in the first hard disk, which is called'/dev/SDA '.
You may use the same command to install grub in any other disks in yourcomputer by replacing the/dev/SDA part of the command with/dev/SDB or/dev/SDC and so on.

-Ifthe command fails with feedback about not being able to access adevice. map file, you might need to try again and specify the exactdevice. Map File to use with the-M option.

Sudo grub-setup-D/Media/Disk/boot/grub-M/Media/Disk/boot/GRUB/device. MAP/dev/SDA

The-M option tells grub what device. map you want to use.

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.