Windows7 has been the talk of the town for quite a few months and it will be the favorites due to lower system usage than Vista.. Recently I gave the new Redmond OS a ride and found it reminiscent of Vista, in-addition to few cosmetic changes that it brings with it.
Well we are not here today to talk about what WIn7 is and what it does .This thread is for those people who intend to dual boot Windows 7 with any of the Linux Operating system.
Prerequisites : -
- Windows 7 DVD
- Any Linux distro with latest grub 0.99.x
- A DVD/CD drive..
In this tutorial we will make Linux and Windows7 multi-boot in which Linux has been installed first.
Once you install Windows7 over any Linux installation, the Windows boot-loader will overwrite the existing grub boot loader and you will not get the Linux entry while booting you system.. In order to get a multi boot we have to restore the grub..
After installing Windows 7 over any linux distro. Insert the Linux Live Cd and boot through it. Once the desktop appears open the Terminal in Gnome or Konsole in kde . to open the respective command client you can either gain access from menu's or simply press ALT + F2 and type the following
Code:
Gnome - [B]gnome-terminal[/B]
KDE - [B]konsole[/B]
This will open the command client in the respective desktop environment. Once it is open, we have to gain root privileges
Code:
Debian based disto - [B]sudo su root [/B]
Rpm based distro -[B] su -[/B]
After you have gain the desired privileges we will focus on restoring the grub and adding windows entries to it..
Type the following command as super user/root one by one
Code:
grub
find /boot/grub/stage1
This will show your Linux boot file location as following
Code:
(hd0,1) # consider 0,1 as X,Y
Note the 1'st word 0 say X indicates the hdd entry number (hard disk number -1 ) in which you have installed Linux. For Example, if you have installed the Linux in hard-disk 1 the it will show the number as 0 and if you have installed in second hard-disk as set in BIOS then it will list the number as 1.
The second number output 1 say Y list the partition ( partition number -1) in which you have installed the distro..
Now once you get the numbers you have just to re-install the grub inorder to restore the default Linux boot manager
Code:
root(hd0,1)
setup (hd0)
Note : Do not forget to replace the number with the output that you get..
Once we are done type quit and reboot the system in Linux.. Open the command client again [not in Live disc mode] and type the following commands after gaining root privileges..
Code:
[B]For Gnome user[/B][B] -[/B] gedit /boot/grub/menu.lst
[B]KDE user -[/B] kwrite /boot/grub/menu.lst
Add these lines at the end where other Linux entries are listed as well..
Code:
title Windows 7 (Loader)
root (hd0,0)
savedefault
makeactive
chainloader +1
Note : here first 0 indicate hard disk number -1 and second 0 indicate partition number -1.. I have installed Windows 7 in the first partition of my primary hard drive therefore the entries are shown as 0,0. It will vary with the partition and hard disk in which you have installed...
Ubuntu 9.10 Onwards : The Grub 2 Mumbo Jumbo
WIth the release of Ubuntu 9.10, the Canonical was quick to adapt with the venerable Grub2, even though the version 2 of the Gnu Bootloader is still under development the people behind ubuntu thought of including it even though its still not in final stage.
Since Ubuntu is one of the most popular distro out there, playing with Grub2 was an essential for almost all those who plan to use uBuntu, even if you don't plan to use it, getting something new under the hood isn't that bad ? Ain't it ?
To recover the grub after installing Windows over the Ubuntu installation, just follow these steps : -
1. Insert Ubuntu Disc 9.10 onward.
2. Enter sudo fdisk -l. Yo u will get output something similar to this :
Code:
shashwat@shashwat-desktop:~$ sudo fdisk -l
[sudo] password for shashwat:
Disk /dev/sda: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0009e36e
Device Boot Start End Blocks Id System
/dev/sda1 1 4514 36258673+ 7 HPFS/NTFS
/dev/sda2 4515 8473 31800667+ 83 Linux
/dev/sda3 * 8474 11802 26740192+ 83 Linux
/dev/sda4 11803 77825 530329716+ 5 Extended
/dev/sda5 11803 18800 56211403+ 83 Linux
/dev/sda6 18801 48903 241802316 83 Linux
/dev/sda7 48904 63885 120342883+ 83 Linux
/dev/sda8 63886 77518 109507041 83 Linux
/dev/sda9 77519 77825 2465946 82 Linux swap / Solaris
shashwat@shashwat-desktop:~$
Now my MBR is installed in the third partition of my hard disk. This means that the main booting parameters are stored here. In no sense this means that my Linux is installed in the same partition, the partition for linux installation can vary from the MBR partition. Just in case you don't rememebr the exact partition you can alway browse the partition using the inbuilt browser Nautilus in Ubuntu disc. Once you have got the partition located (say Ubuntu mount the partition as /media/disk) you can from here get the exact device status from df -h command.
4. df -h should show the following output
Code:
shashwat@shashwat-desktop:~$ sudo df -h
[sudo] password for shashwat:
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 26G 22G 2.5G 90% /
udev 1.9G 280K 1.9G 1% /dev
none 1.9G 2.7M 1.9G 1% /dev/shm
none 1.9G 328K 1.9G 1% /var/run
none 1.9G 0 1.9G 0% /var/lock
none 1.9G 0 1.9G 0% /lib/init/rw
/dev/sda7 115G 37G 79G 32% /media/hd0
/dev/sda6 231G 218G 13G 95% /media/hd1
/dev/sda8 105G 32G 73G 31% /media/hd2
/dev/sr0 683M 683M 0 100% /media/cdrom0
shashwat@shashwat-desktop:~$
Once you have got the exact partition under the belt its time for some mounting and installing.
5. Mount the partition using mount command. Make sure you umount all the partition before doing this.
Code:
umount -a
Now mount that partition using mount command
Code:
mount /dev/sdaX /mnt
Here X refers to the partition number in which the linux (Ubuntu or distro with grub2 is installed). Replace sda with hda or whatever your fdisk -l or df -h output is.
Now install the grub again using the following command : -
Code:
grub-install --root-directory=/mnt /dev/sda
Once done just reboot and open ubuntu, incase your Windows entry is not showing just update the grub using
Code:
sudo update-grub
This tutorial is also applicable in case where Windows is installed first. If some distro fails to add grub and windows entries you can use the above stated method to make a multi-boot solution...
I hope this tutorial helps you in multi-booting OS. You can multiboot any linux, windows or mac using the same procedure.
Please feel free to ask your doubts .
Also check : http://www.techenclave.com/guides-and-tutorials/installing-windows-7-rc-7100-ubuntu-137734.html
Regards