Partition Feng Shui

Linux Jan 10, 2017

Finally got this working today.

Originally I had a Linux Mint installation on my home laptop, with a Windows 10 VM for the rare occasions when I needed to do something windows-only. I'm not a gamer, and so there are few things I can't simply do in a VM. One of the things, however, was watching programmes on the "Now TV" streaming service; it's based on Silverlight, and utilises HDCP to 'ensure' you aren't recording the content.

My ultimate plan was to get the windows installation onto a separate partition, where GRUB could boot to it. It was in fact in a raw disk image, so I allocated some space in my partition table and used dd to copy the whole raw disk image to the new partition.
Then it was a matter of using fdisk to update my partition table to point at the 2 partitions ("Windows Boot Manager" and "System"), rather than to the whole disk image.

Once this was done, I had a normal pair of NTFS partitions sitting on my disk. "Almost there", I thought.

After running update-grub2 and rebooting, I saw that a menu entry had indeed been generated for the windows partition.
It looked fairly standard for booting a windows system from MSDOS disk, setting the root to the windows boot manaager partition and utilising grub's "chainloader +1" command to load and execute volume boot record.
Upon running the entry, however, I just got a black screen with a flashing '_' character.

After googling around, it looks like chainloader +1 doesn't really work any more for booting windows; i had to use grub's 'ntldr' module.
This bypasses the VBR and knows how to run the 'bootmgr' executable in the Boot Manager partition.

I added the following to /etc/grub.d/40_custom:

menuentry 'Windows 10 (loader) (on /dev/sda2)' {
        insmod part_msdos
        insmod ntfs
        insmod ntldr
        set root='hd0,msdos2'
        ntldr /bootmgr

Finally, I booted up a VM with a windows 10 installation/recovery ISO, and with /dev/sda mapped to the first hard drive (this is a very risky thing to do and will quickly knacker your Linux filesystem if the guest VM is permitted to boot the host OS).

Inside the Windows 10 recovery environment, I used bootrec to rebuild the BCD store, so it would reflect the new location of my windows system partition.

I haven't diddled with windows boot for quite a long time, and so this all took far longer than it feels like it should have done. It's all done now, though.

I know GPT is the future and better for various reasons, but this will do for now :)