This writeup describes the process to fix Windows not booting on a VirtIO disk. The VPS only boots when changing the "Disk Driver" to IDE on SolusVM. When the disk device is VirtIO windows fails to boot with an INACCESSIBLE_BOOT_DEVICE
error.
The issue was likely caused due to installation of OSFMount software previously.
Before starting, a full disk image of the VPS may be taken for safety. Enable rescue mode in SolusVM. It will then display the SSH connection credentials. Connect to the server using the same credentials from another server which has sufficient disk space to store the full disk image. Run lsblk
to list the disk drives attached to the system. To inspect the disk manually, run mount
in readonly mode as shown.
# mount -o ro /dev/vda1 /mnt
Individual files can then be copied out if necessary using scp, rsync, File Zilla etc. When done unmount the partition.
# umount /mnt
To take a full disk image (logout from the VPS if necessary) run the following command locally on the system where the backup image will be stored.
ssh [email protected] "dd if=/dev/vda bs=4M conv=sparse | gzip -1 -" | dd bs=100M of=diskimage.gz
The entire process will take hours to complete depending on the size of the disk and the network speed. Hence if the backup VPS is geographically near to the broken VPS the process may be faster.
On Windows dd
can be downloaded from http://www.chrysocome.net/dd. The block size parameter may be changed/increased for faster transfer speeds. Once done rescue mode may be disabled on the VPS.
- https://www.digitalocean.com/community/tutorials/how-to-create-an-image-of-your-linux-environment-and-launch-it-on-digitalocean#step-2-creating-disk-image
- https://askubuntu.com/questions/296331/how-to-mount-a-hard-disk-as-read-only-from-the-terminal
Make sure the Disk Driver is set to virtio in SolusVM. Reboot the VM. From henceforth use the VNC feature in SolusVM to access the VPS. Windows would fail to boot and load the recovery environment instead. At this point start the Shell from the Recovery Environment. The shell would usually start from the X:\
drive. To change to other drive simply type C:\
, D:\
etc.
The drive letter mappings can also be found out by running
wmic logicaldisk get deviceid, volumename, description
At this stage trying to change to the primary partition like C:\
would result in a "Device not ready" or similar error. It indicates that is the primary partition. Windows can't read it as it is using VirtIO and the drivers for it are not loaded.
Next mount the VirtIO drivers ISO file from SolusVM. This is available in the "Drivers" tab on SolusVM dashboard. Once mounted, run the following command to load the viostor driver as follows.
drvload d:\viostor\2k19\amd64\viostor.inf
2k19 is for Windows Server 2019
Now changing to the primary partition would not show an error as the driver is already loaded. Run dir
to confirm it is indeed the primary partition. The usual files and directories under C:\
should be visible.
The next step is to inject the VirtIO storage driver to the Windows Boot environment. This can be done by running the following command
dism /image:c:\ /add-driver /driver:d:\viostor\2k19\amd64\viostor.inf
- The drive letter after
/image
is the primary partition where Windows is installed. TheC:\
drive in a Standard Windows installation - The path to viostor.inf points to the virtio ISO image loaded in the CD drive
At this point exit the recovery command prompt and shut down the system. Remove the VirtIO ISO from the CD drive and restart the system. The VPS would be up and running normally now.
- https://gist.github.com/Francesco149/dc156cfd9ecfc3659469315c45fa0f96
- https://portal.nutanix.com/page/documents/kbs/details?targetId=kA00e000000kAWeCAM
- https://superuser.com/questions/1057959/windows-10-in-kvm-change-boot-disk-to-virtio
- https://learn.microsoft.com/en-us/windows-hardware/manufacture/desktop/add-and-remove-drivers-to-an-offline-windows-image?view=windows-11
- https://www.tenforums.com/tutorials/95008-dism-add-remove-drivers-offline-image.html
- https://droidwin.com/uninstall-drivers-from-windows-recovery-when-pc-cannot-boot-to-os/
- https://linuxhint.com/install_virtio_drivers_kvm_qemu_windows_vm/
- https://pureinfotech.com/uninstall-driver-recovery-environment-windows-10/
- https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers
- https://forums.ivanti.com/s/article/How-To-Use-DISM-to-Manually-Inject-Drivers-into-the-Boot-wim?language=en_US
- https://woshub.com/how-to-rebuild-bcd-file-in-windows-10/