Skip to main content

Recovering an Unbootable Windows VM

A migrated Windows virtual machine that blue-screens with INACCESSIBLE_BOOT_DEVICE is missing the VirtIO storage driver (viostor). Edge presents VirtIO disks to virtual machines, and without the driver Windows cannot see its own boot disk. The reliable fix is installing the drivers before migration, described in Prepare a Windows Source; this page covers recovery when the machine has already been migrated.

The repair happens in place: boot the VM into the Windows recovery environment from a Windows installation ISO, inject the VirtIO drivers into the installed Windows, and boot again from the repaired disk.

Make the ISOs Available on the Host

The recovery needs two ISOs attached to the VM: a Windows installation ISO, which provides the bootable recovery environment, and the VirtIO driver ISO, which provides the drivers. You must supply Windows media you are licensed to use. The VirtIO ISO can be downloaded from the Gallium CDN here.

The Attach ISO dialog lists the ISOs present on the VM's hypervisor. ISOs reach a hypervisor through templates: template media downloads the first time a VM is created from the template there. To stage the ISOs:

  1. Create a template containing both ISOs and a blank disk, following the upload steps in Building a Windows Template Manually. The blank disk can be small; nothing is installed on it. Finalize the template.
  2. Create a VM from the template on the hypervisor hosting the broken VM, with Start VM immediately upon creation turned off.
  3. Delete that VM. Its disks are detached, and the ISOs remain on the hypervisor, ready to attach.

Inject the Drivers from WinPE

The procedure boots the broken VM from the Windows installation ISO into the recovery environment (WinPE) and repairs the Windows installation on disk without moving the disk anywhere.

Boot into the Recovery Command Prompt

  1. With the VM stopped, open its Virtual Disks tab.
  2. Select Attach ISO and attach the Windows installation ISO. The dialog attaches one ISO at a time, so run it again to attach the VirtIO ISO.
  3. Select Set Boot Disk on the Windows installation ISO.
  4. Start the VM and open its console right away with Connect on the Dashboard tab. Press a key at the Press any key to boot from CD or DVD prompt; if you miss it, Reset the VM and try again.
  5. On the installer screen, choose Repair your computer, then Troubleshoot, then Command Prompt.

Load the Storage Driver into WinPE

The recovery environment does not have VirtIO drivers either, so it may not see the VM's disk. First find the drive letter of the VirtIO ISO:

diskpart
list volume
exit

Then load the storage driver into the running WinPE session:

drvload D:\viostor\w10\amd64\viostor.inf

Adjust the drive letter to the VirtIO ISO's letter, and replace w10 with the driver code for the installed Windows version from the table in Supported Windows Versions. drvload affects only the running session, in memory; it changes nothing on disk.

Identify the Windows Volume

Run list volume in diskpart again now that the disk is visible, and look for the large NTFS volume that holds the Windows installation. In the recovery environment its letter is often not C:. Confirm you have the right volume:

dir E:\Windows\System32

When the expected system files appear, note the letter and use it in the following steps.

Inject the Drivers with DISM

DISM installs drivers permanently into the offline Windows installation so they are available at the next boot. Point it at the whole VirtIO ISO with /recurse to install every driver package on the media that applies to the image, so Plug and Play can set up the network and other VirtIO devices on first boot. DISM reports errors for packages built for other architectures or Windows versions; these can be ignored:

dism /image:E:\ /add-driver /driver:D:\ /recurse

To inject only the storage driver instead:

dism /image:E:\ /add-driver /driver:D:\viostor\w10\amd64\viostor.inf

/image: is the root of the offline Windows installation, and /driver: points at the VirtIO media.

Make the Driver Boot Critical

DISM installs the driver files, but the service's Start value must be 0 (boot) for Windows to load the driver before mounting the system volume; any other value, such as 3 (manual), reproduces the blue screen. Set it on the offline registry:

reg load HKLM\OFFLINE E:\Windows\System32\config\SYSTEM
reg query HKLM\OFFLINE\Select /v Current
reg add "HKLM\OFFLINE\ControlSet001\Services\viostor" /v Start /t REG_DWORD /d 0 /f
reg unload HKLM\OFFLINE

If the query returns 0x1, the active control set is ControlSet001; adjust the path if it reports another number. reg unload fails while anything still holds the hive open, so close any registry editor first.

Boot from the Repaired Disk

  1. Leave the recovery environment with wpeutil shutdown.
  2. With the VM stopped, select Set Boot Disk on the operating system disk and Detach the Windows installation ISO.
  3. Start the VM. Windows boots from the VirtIO disk and Plug and Play installs the remaining VirtIO devices.
  4. Once running, run virtio-win-guest-tools.exe from the VirtIO ISO to install the QEMU guest agent, then Detach the VirtIO ISO.

What Each Command Changes

The tools in this procedure act at different layers, which is why all three steps are needed:

CommandWhere it actsPersistence
drvloadThe running WinPE session (memory)Gone on reboot
dism /add-driverThe offline Windows installation on diskPermanent
reg add on the loaded hiveThe offline registry on diskPermanent

drvload lets the recovery environment see the disk right now; DISM and the registry change make sure the installed Windows can see it after the reboot.