2014-03-31

Fixing grub after dual boot installation of windows with linux


Pranaam to all bhai ji _/\_

Today we are going to discuss , how to fix dual boot problem when we install windows on a machine on which a Linux OS is already installed .
because when we install windows, it over writes GRUB bootloader (which contains linux bootable partition information ) and install windows bootloader.
lets spin this shit >:D< ..............

i am going to perform it for centos,fedora and redhat system .
we need rescue disk for it and i have CentOS minimal install iso
here is download link

CentOS-6.5-i386-minimal.iso

ok lets start, boot your system with this disk and select rescue mode


select your language and press enter key to proceed to next step


your country and hit enter key


and now system will ask to start network interfaces , we dont need them so we can skip it
press tab key to select 'no' and hit enter.


in next step, press tab key to select continue and press enter


system will show that partition on which linux is installed , has been mounted to /mnt/sysimage directory
press enter to proceed


in next step , select shell prompt


execute command clear to clear command prompt and then execute command
fdisk -l
this command will list all the partition on disk


okkkk, we got following info

main disk name             /dev/sda
linux partition name      /dev/sda1
Windows partition       /dev/sda2

these are important informations which we requires in recovering bootloader soo note them down
and proceed to next step

make your linux installation as root installation using chroot command
command is
chroot /mnt/sysimage


enter into grub directory to read grub info
grub file is located under /boot/grub directory with name grub.conf
so enter into /boot/grub directory


ok now we need to know, on disk where grub info was stored and we can get it by using grub.conf file
open this file in vi text editor
command is  vi grub.conf


you will see , there is a line written like this
#boot=/dev/some_name
here /dev/some_name is the location where grub info was stored
in mine case, it is /dev/sda


so we have come to know here grub info was stored
and here comes last thing before restoring grub
we need to add windows partition entry in grub.conf file , so that it can provide windows booting option too during booting menu
press i key for insert mode
for this, we need to add following lines at the end of grub.conf file (/boot/grub/grub.conf is the full path to file)

title windows os
     rootnoverify(hd0,1)
    chainloader   +1

here , for one thing you must care is second line
rootnoverify(hd0,1)

hd0 is for main disk and 1 means , second partition of the disk .
as we run fdisk -l command and in result , command showed that /dev/sda1 id first partition and linux is installed on it
/dev/sda2 is the second partition and windows is installed on it(NTFS partition)
so, if your windows partition is installed on /dev/sda2, put these lines in grub.conf


title windows os
     rootnoverify(hd0,1)
    chainloader   +1

and if windows is installed on /dev/sda3
lines will be like this 

title windows os
     rootnoverify(hd0,2)
    chainloader   +1



here
hd0,1 represent /dev/sda2
and
hd0,2 represent /dev/sda3

so put lines according to your windows partition
mine windows system is on /dev/sda2 so it is hd0,1


save the file and exit
press esc key and then type :wq!

now execute command
grub-install /dev/disk

here /dev/disk is the location where grub info was stored and it was  listed in grub.conf (#boot=/dev/sda)
in mine case it was /dev/sda
so command is

grub-install  /dev/sda


and you will get message like this after few seconds


wot wot >:D<

grub has been restored
exit from chrooted environment and reboot your system using command
sync;sync;exit;exit
then
reboot


and here goes shit owned \m/


system is showing linux as well as windows partition :D
one more thing, if you boot into windows and face this screen, just select start windows normally and enjoy windows shit :D



Thank you

Greetz to :-
Zero cool ,code breaker ica, Aasim shaikh,Reborn,lord crusi, Raman kumar rana,INX_r0ot,Darkwolf indishell, lord crusi, Chinmay Pandya ,Silent poison India,Magnum sniper,Atul Dwivedi,ethicalnoob Indishell,Local root indishell,Irfninja indishell,Hardeep bhai,Mannu,Viki , AR AR bhai ji, Anju,RR mam and Deepika kaushik

Share this post

0 comments

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

© 2009 Start With Linux | Mannu Linux
Designed by cyb3r.gladiat0r
Posts RSSComments RSS
Back to top