reinstall grub2(ubuntu 9.10 or later) after overwriting boot section.........
IITDU Forum :: TechTalks :: Ubuntu
Page 1 of 1 • Share •
reinstall grub2(ubuntu 9.10 or later) after overwriting boot section.........
Using the Ubuntu Desktop/Live CD
Overwriting the Master Boot Record
WARNING
Do not use Ubuntu 9.10 live CD to restore the boot loader from a previous version.
The first step is to boot from a Live CD and open a
terminal. You will need to run a few commands as root. One option is to
first run sudo -i which will send you to a root shell from which you will simply run the commands without the sudo
prefix. Be extremely careful when running a root shell, especially for
typos! Even an extra space can do damage to your system. Always backup
on external media before attempting recovery, if at all possible.
Next we will need to find the partition in which your Ubuntu system is installed. Type the command fdisk -l. It will output a list of all your partitions. Example :
fdisk -l
Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System

create a mountpoint for your partition, for example:
mkdir /media/root
Then mount your partition in it. If you don't know
which one it is, then mount any of them, we will determine if it is the
correct one.
mount /dev/sda2 /media/root
Replace /dev/sda2 with the correct name of your partition. To check if it is the correct one, run ls /media/root which should output something like this:

cdrom initrd.img media proc selinux tmp vmlinuznow,
run
ls /media/root/boot, which should output something like this :

Once again, if what you have is not similar, unmount it and try another partition.
Now that everything is mounted, we just need to reinstall GRUB:
sudo grub-install --root-directory=/media/root /dev/sda
If you get BIOS warnings try:
sudo grub-install --root-directory=/media/root /dev/sda --recheck
If all went well, you should see something like this:
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(hd0) /dev/sda
Now restart your pc and remove the cd............
Overwriting the Master Boot Record
WARNING
Do not use Ubuntu 9.10 live CD to restore the boot loader from a previous version.
The first step is to boot from a Live CD and open a
terminal. You will need to run a few commands as root. One option is to
first run sudo -i which will send you to a root shell from which you will simply run the commands without the sudo
prefix. Be extremely careful when running a root shell, especially for
typos! Even an extra space can do damage to your system. Always backup
on external media before attempting recovery, if at all possible.
Next we will need to find the partition in which your Ubuntu system is installed. Type the command fdisk -l. It will output a list of all your partitions. Example :
fdisk -l
Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System

create a mountpoint for your partition, for example:
mkdir /media/root
Then mount your partition in it. If you don't know
which one it is, then mount any of them, we will determine if it is the
correct one.
mount /dev/sda2 /media/root
Replace /dev/sda2 with the correct name of your partition. To check if it is the correct one, run ls /media/root which should output something like this:

cdrom initrd.img media proc selinux tmp vmlinuznow,
run
ls /media/root/boot, which should output something like this :

Once again, if what you have is not similar, unmount it and try another partition.
Now that everything is mounted, we just need to reinstall GRUB:
sudo grub-install --root-directory=/media/root /dev/sda
If you get BIOS warnings try:
sudo grub-install --root-directory=/media/root /dev/sda --recheck
If all went well, you should see something like this:
Installation finished. No error reported.
This is the contents of the device map /boot/grub/device.map.
Check if this is correct or not. If any of the lines is incorrect,
fix it and re-run the script `grub-install'.
(hd0) /dev/sda
Now restart your pc and remove the cd............
_________________________________________________________________
microsoft provides you windows........
ubuntu gives you the whole home..........
---------------------------------------------------------------------------------
Don't forget to visit my blog for more tutorials.....

BIT0111-muctadir- Expert

- Course(s):
- BIT
Blood Group: B+
Posts: 233
Points: 395
Re: reinstall grub2(ubuntu 9.10 or later) after overwriting boot section.........
Thanks man 


_________________________________________________________________
মানুষ তার স্বপ্নের সমান বড়

BIT0129-Tabassum- Global Moderator

- Course(s):
- BIT
Blood Group: A+
Posts: 1496
Points: 2297

IITDU Forum :: TechTalks :: Ubuntu
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Active Topics!

» Understanding Timestamp Based Protocol
» Hi from Newbie
» Compare an image from a list of images in the sql database....tell which image is matching
» Sending email without email ID
» teach yourself c by herbert schildt pdf
» .NET MVC3: Unable to find the requested .Net Framework Data Provider. It may not be installed.
» SAD Slides: 4.1, 4.2
» QA topic Presentation - Urgent Notice