This blog has permanently moved to

Contact Form | Email Address

© 2018 All rights reserved by Boseji

Thank you for all your support.

Friday, June 1, 2012

Windows Install after Linux: Challenge Solved

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:

No comments:

Post a Comment