I have several Hyper-V hosts deployed via SC VMM which is using boot from VHDX.
Today I had the need to wipe the underlying RAID-configuration due to some physical disk changes on 1 of these servers, but I wanted to avoid having to re-install the OS. Hence the plan was to copy the VHDX-file containing the host OS to a
different server while performing maintenance on the RAID-configuration (VMs was replicated to a different host using Hyper-V Replica, and could easily be resynced afterwards).
I booted the server into Win PE, copied the VHDX-file containing the host OS to a temporary location (UNC-path on a different server) before rebuilding the RAID configuration.
After the RAID configuration was as desired, the server was booted into Win PE one more time:
- A new partition was created on the new and empty disk
- The partition was marked as active and formatted
- The VHDX-file containing the host OS was copied from the temporary location to the new volume
The last step was to configure the server to boot from the VHDX-file. Here is the steps I tried:
bcdedit /createstore bcd
bcdedit /import bcd
del bcd
bcdedit /create /d "Windows Server 2012 R2 Standard" /application osloader
bcdedit /set {5293d927-7adb-11e6-be74-9c9dacd2f9f9} path \Windows\System32\winload.exe
bcdedit /set {5293d927-7adb-11e6-be74-9c9dacd2f9f9} locale en-US
bcdedit /set {5293d927-7adb-11e6-be74-9c9dacd2f9f9} systemroot \Windows
bcdedit /set {5293d927-7adb-11e6-be74-9c9dacd2f9f9} device vhd=[C:]\2012R2-Standard.vhdx
bcdedit /set {5293d927-7adb-11e6-be74-9c9dacd2f9f9} osdevice vhd=[C:]\2012R2-Standard.vhdx
bcdedit /set {5293d927-7adb-11e6-be74-9c9dacd2f9f9} hypervisorlaunchtype auto
I then rebooted the server, but it failed to load the OS with the following error:
The Boot Configuration Data file is missing some required information
File:\Boot\BCD
Error code: 0xc0000034
Since I didn`t have more time to troubleshoot I then cleaned the disk in diskpart, re-installed 2012 R2 from an ISO-file and ran the following from the temporary OS:
bcdedit /copy {default} /d "Windows Server 2012 R2 Standard (VHDX)"
bcdedit /set {dc49d685-7570-4a9d-b802-ce2a368e1c20} device vhd=[C:]\2012R2-Standard.vhdx
bcdedit /set {dc49d685-7570-4a9d-b802-ce2a368e1c20} osdevice vhd=[C:]\2012R2-Standard.vhdx
bcdedit /set {dc49d685-7570-4a9d-b802-ce2a368e1c20} hypervisorlaunchtype auto
bcdedit /default {dc49d685-7570-4a9d-b802-ce2a368e1c20}
After reboot the server it booted into the VHDX without problems.
What was wrong with my first approach? Did I miss something?