Adding boot entry in Grub 2


We follow following steps to get Linux distribution access back after windows installation

1) EasyBCD

2) Using boot-repair

I was using second option and successfully installed grub, but problem was grub was not installed on windows partition

and there was no windows boot entry in grub boot menu.

What we can do was simply add manually windows entry in grub.cfg file located in /boot/grub

is there any simple way to add boot entry grub.cfg? Yes

I would suggest to simple execute

sudo update-grub

before adding custom entry, update-grub adds boot entry.

If update-grub command does not add boot entry then go through following steps.

I  have to make boot entry of windows 8.1. Follow steps

1 sudo fdisk -l

Fdisk -l

windows partition in /dev/sda1

2 Go to location in /etc/grub.d and edit file 40_custom

if file is no such a file then create one and ensure following content

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the ‘exec tail’ line above.

This is shell script first two line must be present in this file to make successful boot entry

3 as my windows is on /dev/sda1 i would write

menuentry “Windows 8.1” {
insmod ntfs
set root=’hd0,msdos1′
chainloader +1
}

this to 40_custom line at the end of file

make sure set root=’hd0,msdos1′  is pointing to where you have to boot

Refer following set root mapping

/dev/sda1 ='hd0,msdos1'
/dev/sda2 ='hd0,msdos2'
/dev/sda3 ='hd0,msdos3'

/dev/sdb1 ='hd1,msdos1'
/dev/sdb2 ='hd1,msdos2'
/dev/sdb3 ='hd1,msdos3'

/dev/sdc1 ='hd2,msdos1'
/dev/sdc2 ='hd2,msdos2'
/dev/sdc3 ='hd2,msdos3'

Finally execute sudo update-grub 
and restart to see effect

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s