Install virtio drivers offline for Windows instances

Updated at:
Copy as MD

Install virtio drivers offline to fix ECS instances that fail to start due to missing drivers.

Note

Because the instance cannot start, you must mount its disk to a working instance to install the drivers. This is called offline installation.

Procedure

  1. Create a snapshot of the abnormal instance to back up your data.

    Note

    Snapshots incur fees. See Snapshot billing.

  2. Create a new ECS instance. See Create an instance by using the wizard.

    The new instance must meet these requirements:

    • VPC: Same VPC as the abnormal instance.

    • Image: Use an official image with the same operating system as the abnormal instance.

    Note

    A new ECS instance incurs fees for computing, storage, image, and other resources. Check each billing item. Release the instance after use to avoid ongoing charges.

  3. Detach the system disk of the abnormal instance and attach it as a data disk to the new instance created in Step 2. See Detach or attach a system disk and Attach as a data disk.

  4. Connect to the new instance. Check the attached disk status in Disk Management and take action accordingly.

    Disk status

    Solution

    Disk is offline

    Right-click the disk, and then select Online.

    Disk is read-only

    Clear the read-only property in Windows PowerShell:

    diskpart
    list disk # Confirm the abnormal disk number (such as disk 1)
    select disk 1 # Select the abnormal system disk
    attributes disk # View current disk properties
    attributes disk clear readonly # If the disk is read-only, clear the read-only property
    exit

    Partition has no drive letter

    Right-click the partition, select Change Drive Letter And Paths, and assign a drive letter.

  5. Export virtio drivers from the new instance to a local directory in PowerShell.

    Export-WindowsDriver -Online -Destination <directory for storing the exported data>

    Replace <directory for storing the exported data> with your actual path, for example, C:\test.

  6. Install the exported drivers on the abnormal disk.

    Add-WindowsDriver -Path <abnormal disk drive letter> -Driver <directory for restoring exported data> -Recurse

    Replace <abnormal disk drive letter> and <directory for restoring exported data> with your actual values, for example:

    Add-WindowsDriver -Path D: -Driver C:\test -Recurse
  7. Process the abnormal disk in the following order:

    1. Take offline: In Disk Management, right-click the disk and select Offline.

    2. Detach the disk. See Detach data disk.

    3. Reattach to the source instance as a system disk. See Attach as a system disk.

  8. Restart the source instance and verify that it starts and loads the virtio drivers.