Wed, 13 Mar 2013

Triple-boot Linux + Win7 + Win8 (VHDx)

The bigger the risk, the bigger the reward


Installing a new SSD in my desktop computer forced me to reinstall everything. So I decided on a Linux/Windows dual-boot. However I couldn’t make up my mind if I should go with Windows 7, which has proven its worth over the last few years, or try Windows 8. I most definitely didn’t want to create 3 partitions and triple-boot, because if I later had decided to scrap Windows 8 I’d have to mess around with the partition-scheme and hope that everything works afterwards. If however I like Windows 8, against all odds, I’d be stuck with Windows 7 on one partition.

Finding out that you could install Windows 8 in a VHDx file (including TRIM support) and then boot directly into it was the solution I was looking for.

After all, if Windows 8 turns out to be a disaster, I could just delete the VHDx file and remove the entry from the boot manager. If however, I start to like Windows 8 and never use Windows 7 again, I could just upgrade Windows 7, get rid of the VHDx file and the remove the entry from the boot manager.

Partitioning

I decided to create two partitions: 20GB for Arch Linux and the remaining 220GB for Windows 7, which would also contain the Windows 8 VHDx file. I used a gParted Live USB stick, making sure that the partitions are aligned correctly. By creating the partitions outside the Windows installer it was easy to force the Windows installer to instal into a single partition only, without creating a separate boot/recovery partition. Note that I did not create a swap partition for Linux as I do have 18GB of RAM in the machine. This should be plenty for my current usage scenario. If, however, it turns that I indeed need swap space, I can just create a swap file within the Linux file system and be done with it.

Installing Windows

Windows 7

With the partitions in place I installed Windows 7. Nothing fancy there. Following the first few reboots and some driver installs I started to install Windows 8.

Windows 8

When it came to selecting a partition for Windows 8 I pressed Shift+F10 to open the command prompt and use diskpart to create the VHDx file.

diskpart> create vdisk file="g:\win8.vhdx" maximum=50000 type=expandable
diskpart> select vdisk
diskpart> attach vdisk

After exiting diskpart and the command prompt I refreshed the list of disks and partitions in the setup program and the newly created VHDx file showed up. I selected the partition and continued the installation normally from there. Hint: A warning is displayed, saying that Windows cannot be installed on the newly created VHDx partition, because the BIOS might be unable to boot from it. However, the ‘Next’ button is not disabled and the installation can be continued. (Took me a while to figure that one out…)

Windows Bootmanager Woes

After a successful Windows 8 installation you will be presented with the new graphical Windows 8 boot menu.

Because this new boot menu loads parts of Windows 8 already, it has to restart the machine if you’d like to boot into Windows 7. This is a really annoying behaviour, made worse by the fact that I do have an Adaptec RAID controller installed, which takes about 1 minute to boot.

Luckily there is a solution: Boot into Windows 8 and start msconfig.exe. On the ‘boot’-tab set Windows 7 as the default entry. This will turn off the graphical boot menu and use text-mode only, allowing you to start Windows 7 without the restart. If there are no items in the ‘boot’-tab and/or every control is disabled, start diskpart and mark your Windows 7 partition as active. Restart msconfig.exe and you should be able to make changes.

Windows 7 and Windows 8 were up and running now, including a sanely behaving boot manager.

Linux

The installation of Linux was just a regular installation to the empty partition using ext4, with GRUB being installed into the MBR. Again, nothing fancy there.

Final Note

With everything in place, including TRIM support with each OS, GRUB lets me choose first between Linux and Windows and if Windows is selected the Windows boot menu offers Windows 7 or Windows 8 as options. Perfect.


Enable Javascript to see comments