Friday, June 1, 2012

We took up an unusual challenge today - Installing Windows after Installing Linux.
As you might know we recently migrated to Linux, we needed some of our older software to run. Unfortunately they work only on Windows, so we had a problem at hands.
Here is what we had the initial setup:
  • Laptop with Ubuntu 11.10 Installed
  • Partition 1: /boot - for storing the GRUB loader (256MB max size)
  • Partition 2: Extended Partition
    • Partition 3: / - For root partition (20GB more than enough)
    • Partition 4: SWAP -Linux Swap partition (2GB safe bet)
    • Partition 5: /backup - to store Image backups of Partition 1 & 3 using clonezilla (20GB )
    • Partition 6: /home - to store the user files and profiles (220GB )
  • All on a 500GB Standard Seagate Laptop SATA drive
Now we had some empty space at the end of the drive , but probably not sufficient to install the complete windows package.
Here is what we planned to execute:
  • Shrink the Partition 6 to 100GB only ( This was more than sufficient to have even a kernel compile)
  • Then Shrink the Partition 2 ( Extended Partition ) such that there is 60GB space for the windows installation. Good enough to install two FPGA suits(ISE & Quartus)
  • Create a 60GB NTFS partition at the end of the drive for windows to recognize it.
  • Then install Windows XP onto this partition
  • Finally replace the MBR with GRUB2 installation 
  • Also add windows into the boot list
In order to do all the above we first made a USB bootable pendrive from Ubuntu Live CD. This would be our Saviour in case we loose in between. And it did prove to be really helpful.
  • We first made the Partition modifications using GParted using the Ubuntu  pendrive that we prepared earlier.
  • Next as usual installed the windows operating system.
  • After this we had a working Windows XP version, and the MBR had already been overwritten. 
So now we had the job of making an Image of the MBR before we run with our modifications.
First we boot again using the Ubuntu pendrive and then start a terminal to execute the following commands:
sudo -i
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
grub-install --root-directory=/mnt /dev/sda
chroot /mnt grub-update
After this was complete we were sure that the MBR has been replaced by a new copy of the GRUB2.

The last thing that we needed to do was to make the /dev/sda1 bootable for GRUB to boot. For that we used the GParted to set the boot flag on the drive.
Finally we had a dual booting system with Windows working even thought it was installed after Linux.
One word of caution that the Boot-repair technique suggested in Ubuntu Forums wont work if the geometry or order of the partitions is changed or not as per expected by Boot-repair tool.
Hope that this article would helpful. Let us know your feedback if you come across any problems.

For Further Reading:
http://ubuntuguide.net/how-to-restore-grub-2-after-reinstalling-windows-xpvistawin7/
http://www.dedoimedo.com/computers/grub-2.html

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to Boseji's Blog

Popular Post

Blogger templates

Welcome

Creation by Electronics Hobbyists from Bharat(India) to encourage & help people. This blog hosts the numerous innovations, discoveries and projects we provide.
Our Research Wing Adhar Labs
Contact Form | Email Address
We Support Open Source Hardware Definition v1.0
Creative Commons License
All works on this blog are licensed under a
Creative Commons Attribution-ShareAlike 3.0 Unported License.
Based on a work at forbharat.wordpress.com and m8051.blogspot.com.

Permissions beyond the scope of this license may be available at http://forbharat.wordpress.com/permissions/.
Thank you for all your support.

© A.D.H.A.R Labs Research 2008-2013 . Powered by Blogger.

Follow by Email

Followers

PCB Unit Converter

mils
mm

- Copyright © Electronics for Bharat -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -