I found lot of people having trouble with installing grub or recovering their lost grub. Generally, when we install windows in a system already having Linux operating system then windows boot loader overwrites the grub and thus when user boots the system they doesn’t get option to select their OS at the boot time. This problem can be overcome by installing grub. Grub can be installed either by using windows recovery disk or by using Linux live-disk. A lot of stuffs are there on internet on recovering grub through windows recovery disk. In this post I will show you how to install grub through Linux live-disk.
Step 1 : Boot your Linux live-disk and choose “try” option. You don’t need to install it.
step 2 : use following command to see all your disk partitions
$ sudo fdisk -l
search for Linux partition in the output of the above command
For Debian users :
$sudo mount /dev/sda /mnt
$ sudo grub-install /mnt/boot
$ sudo update-grub
For Fedora user’s :
Open terminal and mount /boot directory of the Linux system(already present in your system) to some location (say /mnt)
$ sudo mount /dev/sda6/boot /mnt
The grub2 packages contain commands for installing a bootloader and for creating a bootloader configuration file. grub2-install will install the bootloader – usually in the MBR, in free unpartioned space, and as files in /boot.
$ sudo grub2-install –boot directory=/mnt/boot /dev/sda
grub2-mkconfig will create a new configuration based on the currently running system, what is found in /boot, what is set in /etc/default/grub, and the customizable scripts in /etc/grub.d/ . A new configuration file is created with:
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
And whola! you are all done. Now restart your computer to see the magic.. 🙂 🙂