Windows 10Windows Server

How to Mirror (RAID1) Boot GPT Hard Drive on Windows 10/ Server 2016 / Server 2019

By October 19, 2020No Comments

In this post we‘ll show you how to create a software mirror (RAID1) from two GPT disks with Windows 10 / Server 2016 / Server 2019 installed for UEFI. We’ll consider a full-featured BCD bootloader configuration that provides correct Windows boot and protects your OS and data in case of any drive failure.

So, I have a simple computer with an UEFI architecture and two identical 50GB disks, but without built-in RAID controller. Our task is to install an OS (Windows 10 / Server 2016 / Server 2019 or a free Hyper-V server) on the first GPT disk and then create a software mirror (RAID1) from two disks. In most cases, if you choose between software and hardware RAID, you’d better select the latter. Motherboards with an integrated physical RAID controller are available even for home users today.

Write an installation Windows ISO image on a DVD/USB stick, boot your computer from this device (in the UEFI mode, not the Legacy one) and run the installation.

After the installation is complete, open Disk Management snap-in (diskmgmt.msc) to make sure that the first disk is using GPT (Disk Properties -> Volumes -> Partition style –> GUID partition table), and the second one is empty (unallocated).

Preparing GPT Partition Table for a Mirror on Disk 2

install windows on gpt disk

Run the command prompt with the administrator privileges and run diskpart. Enter:

DISKPART>List disk

As you can see, there are two local disks available in the system:

  • Disk 0 – a disk with GPT, Windows is installed on
  • Disk 1 – an empty unallocated disk
two disk to create software raid 1 (mirror)

Clean the second disk again just in case and convert it into GPT:

Select disk 1
clean
Convert GPT

Display the list of partitions on the second disk:

List part

If there is at least one partition on the Disk 2 (in my example it is Partition 1, with the Reserved label and Size 128 Mb), delete it:

Sel part 1
Delete partition override

diskpart convert disk to gpt

Display the list of partitions on first disk (disk 0). Then you will have to create the same partitions on Disk 1.

Select disk 0
List part

There are 4 partitions:

  • Recovery – 450MB, a recovery partition with WinRE
  • System – 99MB, an EFI partition (more about the partition structure on GPT disks)
  • Reserved – 16MB, an MSR partition
  • Primary – 49GB, a main partition with Windows image
efi partition table on windows

Create the same partitions structure on Disk 1:

Select disk 1
Create partition primary size=450
format quick fs=ntfs label=”WinRE”
set id=”de94bba4-06d1-4d40-a16a-bfd50179d6ac”
create partition efi size=99
create partition msr size=16
list part

diskpart create efi and msr partition

How to Convert Disks to Dynamic & Create a Mirrored Disk?

Then convert both disks to dynamic:

Select disk 0
Convert dynamic
Select disk 1
Con dyn

diskpart convert gpt disk to dynamic

Create a mirror for a system drive (drive letter C:). Select a partition on Disk 0 and create a mirror for it on Disk 1:

Select volume c
Add disk=1

The following message will appear:

DiskPart succeeded in adding a mirror to the volume

Open Disk Management and make sure that drive C: synchronization has been started (Resynching). Wait till it is over, it may take up to several hours depending on the size of the C: partition.

diskpart add second drive to mirror

When booting Windows, the Windows Boot Manager menu will appear where you can select what disk to boot from. If you do not select a disk manually, the system will try to boot from the first one in 30 seconds:

  • Windows Server 2016
  • Windows Server 2016 – secondary plex
windows server boot manager, Windows Server 2016 – secondary plex

However, the problem is that the bootloader configuration is stored only on the first drive, and if you lose it you won’t be able to boot Windows from the second drive without additional actions. In fact, you have protected your data (but not the Windows bootloader) from a failure of the second disk only.

A software Windows RAID cannot be used to create a fully functional EFI partition mirror. Since the OS boot files are located on the EFI partition, if the first disk fails, you won’t be able to boot from the second disk without the manual repairing of your EFI bootloader. It is quite hard for a beginner and takes some time (you may not have it if there is a crowd of angry users around).

Now we’ll show you how to copy the EFI partition to the second disk and change the BCD bootloader configuration to enable booting Windows from both the first and second drives.

How to Create GPT Mirror for EFI Partition?

Then you have to prepare the EFI partition on the second disk in the mirror in order your computer can use this partition to boot Windows. Assign the drive letter S: to the EFI partition on Disk 1 and format it in FAT32:

Select disk 1
Select part 2
assign letter=S
format fs=FAT32 quick

format efi partition fat32

Then assign the letter P: to the EFI partition on Disk 0:

select disk 0
select partition 2
assign letter=P
exit

How to Copy EFI partition and BCD Store to a Second Drive?

Display the current BCD bootloader configuration using the following command:

bcdedit /enum

When creating a mirror, VDS service has automatically added the BCD entry for the second mirror disk (labeled “Windows Server 2016 – secondary plex”).

bcd configuraion for mirrored drives

In order to allow booting from EFI partition on the second disk if first disk failure, you must change your BCD configuration.

To do it, copy the current Windows Boot Manager configuration:

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

The entry was successfully copied to {44d1d6bf-xxxxxxxxxxxxxxxx}

Then copy the configuration ID and use it in the following command:

bcdedit /set {44d1d6bf-xxxxxxxxxxxxxxxx} device partition=s:

If you have done it correctly, this message will appear:

The operation completed successfully.
bcdedit /set device partition

List the current Windows Boot Manager (bcdedit /enum) configuration. Note that the bootloader is now having two options for boot from EFI partitions on different disks (default and resume object).

windows boot manager default and resume boot order

Then you must copy your BCD store from the EFI partition on Disk 0 to Disk 1:

P:
bcdedit /export P:\EFI\Microsoft\Boot\BCD2
robocopy p:\ s:\ /e /r:0

copy efi and bcd configuration

Rename the BCD store on Disk 1:

Rename s:\EFI\Microsoft\Boot\BCD2 BCD

And delete the copy on Disk 0:

Del P:\EFI\Microsoft\Boot\BCD2

del bcd copy

If your first disk fails, you need to select the “Windows Boot Manager Cloned” item in the Windows Boot Manager (boot menu) and then “Microsoft Windows Server 2016 —  secondary plex” in order to boot your Windows correctly.

If one of the disks fails, you will get the Failed Redundancy message in Disk Management snap in.

failed disk in software mirror (raid 1) on windows server

In this case, you will have to replace the failed disk, delete the mirror configuration and create a software RAID 1 from the beginning.

Leave a Reply