Saturday, April 23, 2011

Reinstall Boot Loader / Grub

Boot loader is a program to select a boot on one of the operating systems residing on a computer. In nany cases, linux users confuse when they lost their grub loader either due to grub damage, install another distro on one computer or discharged because of installing windows (using dual boot). Some people thought that this was totally damaged due to system. Yet the truth this is because the MBR of linux is displaced windows MBR by booting the default windows so that option does not appear and direct booting to windows. This problem can be solved by reinstalling grub. Please follow these steps:

Insert CD live used to install Linux to CD Drive and boot with it.
Open terminal and log in as root with this command
$sudo su
Check in which partition linux is installed
$fdisk -l
the result is something like this

Disk /dev/sda: 250.1 GB, 250059350016 bytes

255 heads, 63 sectors/track, 30401 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0xe5e3c4b8

Device Boot Start End Blocks Id System

/dev/sda1 * 1 2550 20482843+ 7 HPFS/NTFS

/dev/sda2 2551 26893 195535147+ f W95 Ext'd (LBA)

/dev/sda3 26894 28717 14651280 83 Linux

/dev/sda5 2551 8924 51199123+ 7 HPFS/NTFS

/dev/sda6 8925 15298 51199123+ 7 HPFS/NTFS

/dev/sda7 15299 26771 92156841 7 HPFS/NTFS

/dev/sda8 26772 26893 979933+ 82 Linux swap / Solaris

then we know that linux is installed in /dev/sda3

mount that partition
$mount /dev/sda3 /mnt/
reinstall grub
$grub-install --root-directory=/mnt/ /dev/sda

when booting the system select to recovery mode then choose update grub.
now reboot again and the system going well.

No comments:

Post a Comment