May 29, 2016

Installing Windows 10 on a GPT disk with legacy BIOS and GRUB2

In my first entry in this blog, when I set up the hard disk partitions it was ready to install Windows. However, since then I had not returned to deal with this issue and now is the time to take it up.

Since Windows 8, the Windows installer is able to install Windows on GPT partitioned disks, as long as the computer supports the UEFI mode.

In this post I intend to show a method to work around this limitation of Windows installer. I'll install Windows 10 on a computer with a traditional BIOS and the hard disk partitions with GPT style.

Preliminary considerations.

  • This guide is focused on installing Windows 10 in an environment with GRUB2 as boot loader, with the partition table already defined and coexisting with other S.Os.
  • I performed this test using as Windows10_InsiderPreview_x64_ES-ES_10565.iso ISO image, downloaded from the official repositories of Microsoft.
  • This installation procedure has been successfully tested on Windows 8.1.

Technical requirements.

  • Is necessary to install the memdisk module on the same partition where resides GRUB2.
  • In order to perform the installation  two pendrives are required, with a minimum capacity of 4GB. The pendrive #1 is used to create a Windows PE from where we make the installation. The  pendrive #2 or Helper Pendrive we use it temporarily to accommodate the boot loader of Windows 10 until we complete the post-installation tasks of this guide.

Installation Method.

We will perform a manual installation of Windows 10, for this we will create an image of Windows pre-installed -Windows PE- from the boot.wim file using the script  mkwinpeimg, depending on the Linux distribution you can find it in the packages wimlib or wimtools.

From the Windows PE we will make the file systems configuration, format the Helper Pendrive, create the vdisk file, and load Windows 10 from the install.wim file.

Finally we perform the GRUB2 configuration in order to load Windows 10.

Preinstallation tasks.

We perform the preinstallation task in linux, assuming that we have the ISO image of Windows in the directory /home/bandido/Downloads.

Preparing partitions for Windows 10.
Partitions 3, and 5 had previously assigned to the installation Windows 10.

install.wim file extraction.
First the install.wim file are extracted:

# mkdir /mnt/ISO
# mkdir /mnt/NTFS
# mkdir /home/bandido/iso
# mount -o loop /home/bandido/Descargas/Windows10_InsiderPreview.iso /mnt/ISO 
# mount /dev/sda18 /mnt/NTFS
# cp /mnt/ISO/sources/install.wim /mnt/NTFS

For convenience the install.wim file is transferred to a partition formatted as NTFS. 

Setting up pendrive #1 as PE Windows 10.
Once we have the boot.wim file we can create the pendrive #1 as Windows PE from where we perform the Windows Installation:
# mkwinpeimg --iso --windows-dir=/mnt/ISO /home/bandido/iso/windows10PE.iso 
:: Copying primary boot files from mounted Windows DVD (/mnt/ISO) [DONE]
:: Exporting image from "/mnt/ISO/sources/boot.wim" [BUSY] Writing LZX-compressed data using 2 threads
694 MiB of 694 MiB (uncompressed) written (100% done)
:: Making ISO image "/home/bandido/iso/windows10PE.iso" [BUSY] Warning: creating filesystem that does not conform to ISO-9660.
The image (/home/bandido/iso/windows10PE.iso) is 257009664 bytes.
:: Exporting image from "/mnt/ISO/sources/boot.wim" [BUSY] Writing LZX-compressed data using 2 threads694 MiB of 694 MiB (uncompressed) written (100% done) [DONE]:: Making ISO image "/home/bandido/iso/windows10PE.iso" [BUSY] Warning: creating filesystem that does not conform to ISO-9660. [DONE]The image (/home/bandido/iso/windows10PE.iso) is 257009664 bytes.

Then we copy the created ISO to the pendrive #1, in my case I used the program WinUSB.

Transferring memdisk to GRUB2.
We copy the memdisk module to the partition where resides GRUB2:

# mkdir /mnt/GRUB2# mount /dev/sda2 /mnt/GRUB2
# mkdir /mnt/GRUB2/boot/syslinux
# cp /boot/syslinux/memdisk /mnt/GRUB2/boot/syslinux

The source directory of memdisk can be any medium containing an image of archlinux. 

Installation Steps.

After completing the pre-installation tasks we are able to start installing Windows 10.

1.- Boot Windows PE from the Pendrive # 1. After starting the Windows PE, press Shift+F10 to access the command interpreter.

2.- Run the command DISKPART and begin to prepare the partition 5  as a target unit for installation:

Microsoft DiskPart versión 10.0.10565
Copyright (C) 1999-2013 Microsoft Corporation.
En el equipo: MINWINPC
DISKPART> list disk
Núm Disco Estado Tamaño Disp Din Gpt
---------- ---------- ------- ------- --- ---
* Disco 0 En línea 465 GB 1920 MB *
Disco 1 En línea 7656 MB 0 B

DISKPART> select disk 0
DISKPART> list partition
Núm Partición Tipo Tamaño Desplazamiento
------------- ---------------- ------- ---------------
Partición 1 Desconocido 2048 KB 1024 KB
Partición 2 Desconocido 1024 MB 3072 KB
Partición 3 Reservado 128 MB 1027 MB
Partición 4 Principal 32 GB 1155 MB
Partición 5 Principal 32 GB 33 GB
Partición 6 Desconocido 32 GB 65 GB
Partición 7 Desconocido 32 GB 97 GB
Partición 8 Desconocido 32 GB 129 GB
Partición 9 Desconocido 32 GB 161 GB
Partición 10 Desconocido 8 GB 193 GB
Partición 11 Desconocido 32 GB 202 GB
Partición 12 Desconocido 32 GB 234 GB
Partición 13 Desconocido 32 GB 266 GB
Partición 14 Desconocido 32 GB 298 GB
Partición 15 Desconocido 32 GB 330 GB
Partición 16 Desconocido 32 GB 362 GB
Partición 17 Desconocido 32 GB 394 GB
Partición 18 Principal 32 GB 426 GB
Partición 19 Desconocido 6921 MB 459 GB

DISKPART> select partition 5
DISKPART> format label="Windows 10" quick
DISKPART> assign letter=c

3.- Insert The Helper Pendrive and prepare it for use as a boot disk.

DISKPART> list disk
Núm Disco Estado Tamaño Disp Din Gpt
---------- ---------- ------- ------- --- ---
* Disco 0 En línea 465 GB 1920 MB *
Disco 1 En línea 7656 MB 0 B
Disco 2 En línea 3690 MB 0 B


4.- We prepare the vdisk to be subsequently used by GRUB2 to start the Windows boot process:

DISKPART> create vdisk file=c:\bootmgr.vhd maximum=32 type=fixed
DISKPART> attach vdisk
DISKPART> list disk
Núm Disco Estado Tamaño Disp Din Gpt
---------- ---------- ------- ------- --- ---
Disco 0 En línea 465 GB 1920 MB *
Disco 1 En línea 7656 MB 0 B
Disco 2 En línea 3690 MB 0 B
* Disco 3 En línea 32 MB 32 MB

DISKPART> select disk 3
DISKPART> create partition primary offset=1024
DISKPART> active
DISKPART> format label=bootmgr quick
DISKPART> assign letter=b

5.- From the command line we proceed to install Windows on drive C :, The NTFS partition where we had previously transferred the install.wim file has  the letter E:
E:\>dism /Apply-Image /ImageFile:install.wim /Index:1 /ApplyDir:C:\

6.-Prepare the drive B: and K: (vdisk and Helper Pendrive) so you can boot Windows from them:

E:\>bootsect /nt60 b: /mbr
E:\>bcdboot c:\Windows /s b:
E:\>bootsect /nt60 K: /mbr
E:\>bcdboot c:\Windows /s K:

7.- Reboot the computer from  Helper Pendrive and we finish the installation.

8.- Once completed the installation we open a command window and we create a task in order to mount the virtual disk at each boot This  is necessary for Windows to function properly when booting from GRUB2.
schtasks.exe /Create /TN MOUNT_VHD /SC ONSTART /TR "powershell.exe Mount-DiskImage -ImagePath c:\bootmgr.vhd  -NoDriveLetter"

Final Step of the Windows Setup.

Post-installation tasks.

After completing the installation, boot from Linux to configure GRUB2 in order to boot Windows using the vdisk:

1.- Copy the vdisk from the Windows partition to the GRUB2 partition.
# mount /dev/sda2 /mnt/grub
# mount /dev/sda5 /mnt/win
# cp /mnt/win/bootmgr.vhd /mnt/grub/boot/vhd/bootmgr_w10.vhd

2.- Add to the configuration file grub.cfg the following entry:

menuentry "Windows 10 preview" {
linux16 /boot/syslinux/memdisk harddisk initrd16 /boot/vhd/bootmgr_w10.vhd

Final thoughts 

In the preparation of this blog I have tried, unsuccessfully, to install Windows without creating the Helper Pendrive, booted from GRUB2 through the vdisk. But Windows need to access the disk with the boot sector and without it is not possible to complete the Windows initiation sequence.

To meet this requirement the Helper Pendrive is used during the installation process. After the task of mounting the vdisk is created, it will be acessible during the Windows boot sequence, completing this normally. From this point we can dispense Helper Pendrive.

As far as I can determine the operation of Windows is stable with this installation procedure, I installed Windows Vista drivers and updated Windows without incident.


  1. This comment has been removed by a blog administrator.

  2. Excelente articulo, justo lo que buscaba: tengo una laptop algo antigua sin UEFI, solo admite legacy BIOS y quisiera tener windows10 con ubuntu en esquema GPT. Voy a seguir tu guia paso a paso y si tengo dudas te dejo comentario. Saludos.

  3. You do not need to copy virtual disk to Grub2 partition.
    It is better to point directly to the VHD that resides on the windows partition.
    Grub2 can access it perfectly (if no encryption is used).

    If you do the 'copy', please add a warning: Each time Windows changes anything on that virtual disk, the user must re-cooy the VJD to Grub2 partition.

    Setting Grub2 config to point ditectly to VHD on Windows partition makes only one copy exist, and any change Windows does to the BCD catalog will be used on next boot, since both )Grub2 memdisk and Windows) use the same VHD file.

    Hope you can improve that on this genial post.

    I had done similar tricks on the past, also for WindowsXP, but for XP memdisk is not enough (does not work), you need GRU4DOS.EXE loaded from Grub2 and make GRUB4DOS emulate a real HDD with such VHD in ram drive. And you need a tool VHDMOUNT inside XP. Remember XP does not use BCD catalog, just boot.ini and such files.
    For XP is much more complex than for the rest. Vista also requieres that VHDMOUNT tool.

    I had used it for a six different 32bits Windows (home versions) multi-boot (XP, Vista, 7, 8, 8.1 and 10) having them isolated from each other (no one sees any data of the others) with only one HDD in GPT mode with BIOS only, no EFI at all... too much complex to do and to write it here, and i used a different technique of install... i use a dummy disk to do normal install (one disk - one windows) then put in on USB and clone partition with GParted to mixed windows GPT disk, then reboot with install media and move boot BCD, for XP is just copying files (easy), but for Vista and UP it is BCD edit.

    Your method of a dummy pendrive where BCD boot is stored is much more easy than what i had used on the past, thanks for such idea, but it is too late for me, sure next time i will do such with a USB 3.1 64GiB stick (100MiB/s write).

    Thanks for pointing on the idea of using pendrives or memory card as the dummy for initial boots.


Comments are welcome, I encourage you to contribute by proposing topics of your interest to develop in this blog.