Friday, August 28, 2009

how to install windows after linux installed.

I have seen so many are getting problem of installing windows on machine which has linux already installed.
Here are simple steps to install.
(Please take backup of your imp date before doing this)

On linux shell do fdisk -l

shows you all disks.
Free one of the partition.

Restart the system install windows on that partition. (make sure of partition on which window are installing).

Now if you reboot, only windows will come. (expected result).

Now put linux boot able CD or DVD and restart.
Boot from the CD or DVD.
at prompt boot:...
type "linux rescue" (without quotes) and enter.(according to centOS)
Follow steps will lead to shall prompt.

Now mount your boot partition if you have boot as separate partition, if root partition itself contain boot then mount root partition.

ex: mount /dev/sda2 /mnt/temp
cd /mnt/temp

Now open menu.lst (probably it is in /root/boot/grub/menu.lst or /boot/grub.lst)
Add bellow lines

title Windows xp
root (hda0,0)
makeactive
chainloader +1

Here depending on your partion you need to modify the parameters.
Title :- Name you want to see at boot menu list.
root :- It is the partition where menu.lst present. Genrally grub list all disks as "hda" even you have sata hard disk.One more thing is fdisk -l list partitions staring index from 1 to ...
ex:- sad1, sda2....
but grub will take hda0, hda1, hda2 .....
So, if for example boot partion is sda3 you need to give "root (hda2, 0)".
Other two paramets doesn't change.

Now at shall enter grub command.
ex:
sh#grub
grub> root (hda0)
grub> setup (had0)
grub> quit
sh#reboot

After reboot in boot from list, it will show liux and windows.
Now choose from which you want to boot.
Enjoy.............

1 comment:

Sureshcollections said...

sh#grub
grub> find /boot/grub/stage1
grub> root (hd0,0)
grub> setup (hd0)
grub> quit