Here is the step by step guide to recover Grub 2 (with ubuntu 9.10) after windows install. The steps are different than for recovering Grub 1 (as explained in this post:
You will need a LIVE cd if you are going to recover an Ubuntu Box. Boot the system with Live CD (I assume you are using Ubuntu Live CD). Press Alt+F2 and enter gnome-terminal command. And continue typing :
$sudo fdisk -l
This will show your partition table:
Device Boot Start End Blocks Id System
/dev/sda1 * 1 12748 102398278+ 7 HPFS/NTFS
/dev/sda2 12749 60800 385977690 f W95 Ext'd (LBA)
/dev/sda5 12749 13003 2048256 82 Linux swap / Solaris
/dev/sda6 13004 16827 30716248+ 83 Linux
/dev/sda7 16828 25272 67834431 83 Linux
/dev/sda8 25273 32125 55046302+ 7 HPFS/NTFS
/dev/sda9 32126 60800 230331906 7 HPFS/NTFS
Now we need to mount Linux (sda6 and sda7 here). sda6 is the / partition and sda7 is the /home partition. So mount them accordingly. If you have any other partitions (specially boot partition) dont forget to mount them.
$sudo mount /dev/sda6 /mnt
$sudo mount /dev/sda7 /mnt/home
$sudo mount --bind /dev /mnt/dev
$sudo mount --bind /proc /mnt/proc
$sudo mount --bind /sys /mnt/sys
Now chroot into the enviroment we made :
$sudo chroot /mnt
You may want to edit /etc/default/grub file to fit your system (timeout options etc)
$vi /etc/default/grub
Once you are thru install grub2 by using
$grub-install /dev/sda
If you get errors with that code use:
$grub-install --recheck /dev/sda
Now you can exit the chroot, umount the system and reboot your box :
$exit
$sudo umount /mnt/home
$sudo umount /mnt/sys
$sudo umount /mnt/dev
$sudo umount /mnt/proc
$sudo umount /mnt
$sudo reboot
Showing posts with label restore boot. Show all posts
Showing posts with label restore boot. Show all posts
Tuesday, February 02, 2010
Friday, June 05, 2009
Trying out windows 7
So, you have windows xp and linux (preferably ubuntu) installed on your system. And you did not install windows vista because it has issues with running some games and also because it is a resource hog. It chews on your resources until none is left. Well, you saw windows 7, you read its reviews and you figured out that maybe you should try windows 7. Here is a how-to of how i went about installing windows 7 and the moments of despair and surprise associated with it.
First of all, you have to download windows 7 from the microsoft's site. I was surprised that microsoft - for the first time in the history of mankind is giving out windows 7 OS for free (even if it is for a year only). Go ahead and download Windows 7. Select the version you want to download 32 bit or 64 bit. Preferably you should go with 32 bit if dont want to worry much about compatibility issues. But if you feel very adventurous, you can also try out the 64 bit version. The 32 bit is of around 2.5 GB and the 64 bit is of around 3 GB. I was surprised by the download speed. I was ablt to download it in an hour or so.
Next, get a DVD-R, and burn the image on DVD-R. But before you proceed to installing windows 7, you need to create some space on your already filled up drive. I have a 500 GB drive with 250 GB dedicated to dumps of games and movies and songs and pics. Out of the remaining 250 GB, i had 100 GB dedicated to windows xp and 150 GB dedicated to linux (2 drives - 100 GB /home and 50 GB /). So, to create more space i decided to shrink my linux drives to 70 GB /home and 30 GB / making around 50 GB free space for windows 7.
To go about resizing partitions, i first decided to use partition magic. But then the geek within me protested. Why should i go ahead and find a crack for a paid partition editor when i can use something like gparted (in linux) to do the same work. I popped in a live cd of kubuntu 8.10 (thinking about it now - i should have created a live cd of ubuntu 9.04). After boot up, I found out that kubuntu does not ship with gparted installed. Hell, so i did a "sudo apt-get install gparted" to install gparted on the virtual drive. It took around 10-15 minutes on my 256 KB connection.
After opening up gparted i simply resized the required partitions and applied the changed. Resizing a partition is an easy job. But moving partitions around is a heavy job. So make changes in such a manner that moving parititons around should not be necessary. I made the mistake of moving my bigger partition (70 GB) and i realized it later. It took around 1.5 hours to do this. And it is always advisable to backup your important data on an external drive before doing this. In case you screw up.
By luck every thing went well and later i was able to boot up both in windows xp & ubuntu.
Now was the time to start installation of windows 7. I popped in the DVD and the main screen came up. Remember to write down the product key that you got during downloading the iso. Windows still punishes you severely if you dont write down the product key. It asks the product key in the middle of installation and if you have forgotten to note down the product key, you will have to do all the work again.
The installation of windows 7 took around 45 minutes. The bad thing is that at times there is no activity and I was confused whether anything is happening or not. Remember to wait and watch. Basically there are 3 steps in installation. Remember to choose custom installation and the free space on your drive for installation. I was surprised that installation started in a flash after i selected the drive. I was hoping to get an installation summary and an option of correcting any mistake i had done. So be-ware, a wrong click and kill your system. Remember to remove the DVD during the first boot - it does not prompt you to do so, but if you dont, you would be starting the installation again. After 2-3 reboots your system is ready and you will get a boot screen (black and white) with option for "earlier version of windows" or "windows 7".
Now all you need to do is restore your grub boot menu. Again pop in your ubuntu live cd and boot up ubuntu. Open a terminal and type.
sudo grub
grub> find /boot/grub/stage1
If you get error 15 "file not found" try
grub> find /grub/stage1
You will get something like (hdX,Y). Do
grub> root (hdX,Y)
grub> setup (hd0)
grub> quit
Now simply reboot and you should be getting your grub boot menu back. Select windows and get the boot menu for windows xp / windows 7.
Whew!!!!
First of all, you have to download windows 7 from the microsoft's site. I was surprised that microsoft - for the first time in the history of mankind is giving out windows 7 OS for free (even if it is for a year only). Go ahead and download Windows 7. Select the version you want to download 32 bit or 64 bit. Preferably you should go with 32 bit if dont want to worry much about compatibility issues. But if you feel very adventurous, you can also try out the 64 bit version. The 32 bit is of around 2.5 GB and the 64 bit is of around 3 GB. I was surprised by the download speed. I was ablt to download it in an hour or so.
Next, get a DVD-R, and burn the image on DVD-R. But before you proceed to installing windows 7, you need to create some space on your already filled up drive. I have a 500 GB drive with 250 GB dedicated to dumps of games and movies and songs and pics. Out of the remaining 250 GB, i had 100 GB dedicated to windows xp and 150 GB dedicated to linux (2 drives - 100 GB /home and 50 GB /). So, to create more space i decided to shrink my linux drives to 70 GB /home and 30 GB / making around 50 GB free space for windows 7.
To go about resizing partitions, i first decided to use partition magic. But then the geek within me protested. Why should i go ahead and find a crack for a paid partition editor when i can use something like gparted (in linux) to do the same work. I popped in a live cd of kubuntu 8.10 (thinking about it now - i should have created a live cd of ubuntu 9.04). After boot up, I found out that kubuntu does not ship with gparted installed. Hell, so i did a "sudo apt-get install gparted" to install gparted on the virtual drive. It took around 10-15 minutes on my 256 KB connection.
After opening up gparted i simply resized the required partitions and applied the changed. Resizing a partition is an easy job. But moving partitions around is a heavy job. So make changes in such a manner that moving parititons around should not be necessary. I made the mistake of moving my bigger partition (70 GB) and i realized it later. It took around 1.5 hours to do this. And it is always advisable to backup your important data on an external drive before doing this. In case you screw up.
By luck every thing went well and later i was able to boot up both in windows xp & ubuntu.
Now was the time to start installation of windows 7. I popped in the DVD and the main screen came up. Remember to write down the product key that you got during downloading the iso. Windows still punishes you severely if you dont write down the product key. It asks the product key in the middle of installation and if you have forgotten to note down the product key, you will have to do all the work again.
The installation of windows 7 took around 45 minutes. The bad thing is that at times there is no activity and I was confused whether anything is happening or not. Remember to wait and watch. Basically there are 3 steps in installation. Remember to choose custom installation and the free space on your drive for installation. I was surprised that installation started in a flash after i selected the drive. I was hoping to get an installation summary and an option of correcting any mistake i had done. So be-ware, a wrong click and kill your system. Remember to remove the DVD during the first boot - it does not prompt you to do so, but if you dont, you would be starting the installation again. After 2-3 reboots your system is ready and you will get a boot screen (black and white) with option for "earlier version of windows" or "windows 7".
Now all you need to do is restore your grub boot menu. Again pop in your ubuntu live cd and boot up ubuntu. Open a terminal and type.
sudo grub
grub> find /boot/grub/stage1
If you get error 15 "file not found" try
grub> find /grub/stage1
You will get something like (hdX,Y). Do
grub> root (hdX,Y)
grub> setup (hd0)
grub> quit
Now simply reboot and you should be getting your grub boot menu back. Select windows and get the boot menu for windows xp / windows 7.
Whew!!!!
Subscribe to:
Posts (Atom)