Setting Up Mirrored Boot Hard Drives in Windows 10

This is a thing I have to do from time to time, and up to now I’ve been depending on two different sets of instructions (because one was not correct for Windows 10, and the other isn’t complete). So I’ve finally written my own instructions, and here they are.

Disclaimer

This is a somewhat advanced procedure.  Try it at your own risk.  I will not be responsible if this kills your computer, eats your family pictures for seven generations, or causes the heat death of the universe… or any other bad thing, big or small.  This is the procedure I used yesterday, and as far as I know it’s good, but follow it at your own risk.

Introduction

First, it’s important that the partition structure of the boot drive be “normal,” that is, the way Windows 10 would create it. The instructions below won’t work right if the partitions are in a different order. Unfortunately, many system builders (including my distributor) use a non-standard partition layout.

So for me, at least, the first thing to do is to erase the hard drives with zeros (I use a Linux boot flash drive for this) and then reinstall Windows 10 on the primary drive. This task will not be described here, as it’s a very basic procedure.

Assuming we are starting with the first hard drive having a more or less default Windows installation (on a GUID formatted drive), and the second being entirely blank, here’s how we do it:

Duplicate the Recovery Partition:

Open an administrative command prompt window, then run the diskpart command. We need the information about the Recovery Partition, so execute these commands:

1
2
3
select disk 0
select partition 1
detail partition

You should get something like this:

1
2
3
4
5
6
Partition 1
Type    : de94bba4-06d1-4d40-a16a-bfd50179d6ac
Hidden  : No
Required: Yes
Attrib  : 0X8000000000000001
Offset in Bytes: 1048576

Volume ### Ltr Label Fs Type Size Status Info
———- — ———– —– ———- ——- ——— ——–
* Volume 4 Recovery NTFS Partition 529 MB Healthy Hidden

Take careful note of the Type ID (i.e. Type, above) as well as its size.

Now make sure the second drive is GPT, then create a new Recovery Partition there:

1
2
3
4
5
6
7
8
select disk 1
convert gpt
select partition 1
delete partition override
create partition primary size=529 (or whatever size is given in the details)
format fs=ntfs quick label=Recovery
select partition 1
set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac (or whatever Type ID was given in the details)

We’ll need drive letters assigned to both the original and the duplicate recovery partitions:

1
2
3
4
5
6
7
select disk 0
select partition 1
assign letter=q
select disk 1
select partition 1
assign letter=r
exit

That last command will take you out of diskpart. Now we need to use robocopy to make a duplicate of the original recovery partition:

1
robocopy.exe q:\ r:\ * /e /copyall /dcopy:t /xd "System Volume Information"

Duplicate the EFI System Partition:

Next, we need to duplicate the EFI System Partition. Back into diskpart:

1
2
select disk 0
list partition

You’ll get something like this:

1
2
3
4
5
6
Partition ###  Type              Size     Offset
-------------  ----------------  -------  -------
Partition 1    Recovery           529 MB  1024 KB
Partition 2    System              99 MB   530 MB
Partition 3    Reserved            16 MB   629 MB
Partition 4    Primary            930 GB   645 MB

Note the sizes of the System and Reserved partitions, and recreate them on the second drive:

1
2
3
4
5
select disk 1
create partition efi size=99 (or whatever the partition list indicates)
format fs=fat32 quick
assign letter=t
create partition msr size=16 (or whatever the partition list indicates)

We need the primary disk System partition to have a drive letter:

1
2
3
4
select disk 0
select partition 2
assign letter=s
exit

Now we’re out of diskpart again, off to robocopy:

1
robocopy.exe s:\ t:\ * /e /copyall /dcopy:t /xf BCD.* /xd "System Volume Information"

Mirror the Operating System Partition:

Most instructions say to close the Admin CMD window at this point, but you can honestly just ignore it; you’ll need it again later, so close it or leave it
open, does not matter.

You need to launch diskmgmt.msc now, or just go to Computer Management and select the Disk Manager section. Right-click on the primary disk and choose Convert to Dynamic Disk, then do the same for the secondary disk. Finally, right-click on the C: volume and choose Add Mirror to choose a drive for the mirror. Select Disk 1 and click the Add Mirror button.

This is the boring part. You need to wait for the mirroring to complete before moving on to duplicating the BCD boot instructions (in the next part, below).

Prepare the BCD Boot Entries

The procedures done so far have created a proper mirror of the boot drive, and a boot menu item has been added to allow you to boot from the secondary plex (drive). However, if the primary drive fails, booting from the secondary drive may fail as well. It is possible to use a boot CD and repair the boot on the secondary drive, and this is always an option, but duplicating the BCD boot information on the secondary drive should remove any need for this.

If the Admin command prompt has been closed, you’ll need to reopen it; if the system has booted, you’ll need to reassign the drive letters for the EFI partitions. To do this, run diskpart and enter the following commands:

1
2
3
4
5
6
7
select disk 0
select partition 2
assign letter=s
select disk 1
select partition 2
assign letter=t
exit

Now you’re back at the command prompt. Type the following commands:

1
2
3
s:
cd EFI\Microsoft\Boot
bcdedit /enum

That last command should give you something like this (warning, long):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=S:
path                    \EFI\MICROSOFT\BOOT\BOOTMGFW.EFI
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {current}
resumeobject            {6fb37501-3d6b-11ea-914e-85f8d8cf8c72}
displayorder            {current}
{6fb37506-3d6b-11ea-914e-85f8d8cf8c72}
toolsdisplayorder       {memdiag}
timeout                 30

Windows Boot Loader
——————-
identifier {current}
device partition=C:
path \Windows\system32\winload.efi
description Windows 10
locale en-US
inherit {bootloadersettings}
recoverysequence {6fb37503-3d6b-11ea-914e-85f8d8cf8c72}
displaymessageoverride Recovery
recoveryenabled Yes
isolatedcontext Yes
allowedinmemorysettings 0x15000075
osdevice partition=C:
systemroot \Windows
resumeobject {6fb37501-3d6b-11ea-914e-85f8d8cf8c72}
nx OptIn
bootmenupolicy Standard

Windows Boot Loader
——————-
identifier {6fb37506-3d6b-11ea-914e-85f8d8cf8c72}
device partition=C:
path \Windows\system32\winload.efi
description Windows 10 – secondary plex
locale en-US
inherit {bootloadersettings}
recoverysequence {6fb37503-3d6b-11ea-914e-85f8d8cf8c72}
displaymessageoverride Recovery
recoveryenabled Yes
isolatedcontext Yes
allowedinmemorysettings 0x15000075
osdevice partition=C:
systemroot \Windows
resumeobject {6fb37501-3d6b-11ea-914e-85f8d8cf8c72}
nx OptIn
bootmenupolicy Standard

The boot loader entry entitled “Windows 10 – secondary plex” was added when the C: drive was mirrored. Now we clone the working Windows Boot Manager:

1
bcdedit /copy {bootmgr} /d "Windows Boot Manager Cloned"

You’ll get a reply like this:

1
The entry was successfully copied to {6fb37507-3d6b-11ea-914e-85f8d8cf8c72}.

The GUID at the end will vary, of course. Use it in the following command:

1
bcdedit /set {GUID} device partition=t:

Now we need to export the BCD store to copy it to the T: drive:

1
bcdedit /export T:\EFI\Microsoft\Boot\BCD

This should complete the operation. Rebooting the system to remove any excess drive letter assignments is recommended.