All Products
Search
Document Center

Elastic Compute Service:Update the Red Hat virtio driver on a Windows instance

Last Updated:Jul 26, 2024

Specific operations performed on a Windows Elastic Compute Service (ECS) instance depend on the virtio driver version of the image that runs on the instance. If you want to resize a disk online, the virtio driver version must be later than 58011. If the instance was created earlier than March 30, 2019, the virtio driver version may be earlier than 58011. If you want to query the serial numbers of disks, the virtio driver version must be later than 58017. If the instance was created earlier than May 1, 2020, the virtio driver version may be earlier than 58017. If the virtio driver version of the current Windows instance does not meet the requirements, you must update the virtio driver before you can perform related operations. This topic describes how to view and update the virtio driver of a Windows instance.

Limits

You can update the virtio driver only for Windows Server 2008 and later versions.

Procedure

  1. (Optional) Create snapshots to back up data.

    We recommend that you create snapshots for the Windows instance whose virtio driver you want to update to back up instance data. If an exception occurs on the instance when you update the virtio driver, you can use the snapshots to roll back the data of the instance. For more information, see Create a snapshot for a disk.

  2. Disable third-party antivirus software.

    To ensure that the update script or Cloud Assistant plug-in of the virtio driver runs as expected, we recommend that you log on to the Windows instance and temporarily disable third-party antivirus software installed on the instance. You do not need to disable the built-in antivirus software of the instance. After you confirm that the virtio driver on the Windows instance does not need to be updated or that the virtio driver update is complete, restart the third-party antivirus software at the earliest opportunity.

  3. View the virtio driver version of the current instance and determine whether to update the virtio driver based on your business requirements.

    View the virtio driver version by using PowerShell

    1. Connect to the Windows instance.

      For more information, see Connect to a Windows instance by using a password or key.

    2. Open the Run dialog box.

    3. Enter powershell and click OK to start PowerShell.

    4. Run the following command to check the virtio driver version:

      [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Windows\System32\drivers\viostor.sys")
      Note

      The viostor.sys file is associated with storage device drivers in virtualization environments, specifically for virtual disk controllers on Microsoft Hyper-V virtual machines. When an operating system runs as a virtual machine on a Hyper-V platform, the driver associated with the viostor.sys file works with the virtualization layer of the host to ensure that the guest operating system can read data from and write data to the virtual hard disk like on a physical hard disk. The viostor.sys driver is an important component that ensures virtual machine disk I/O performance and compatibility.

      The following command output is returned.virtio版本信息

      Determine whether the virtio driver needs to be updated based on whether the end number of the ProductVersion value is lower than 58011 or 58017.

      Scenario

      Virtio driver version

      Operation

      Resize a disk online

      58011 or later

      You can resize the disk online without the need to update the virtio driver. For more information, see Step 1: Resize a disk to extend its capacity.

      Earlier than 58011

      You cannot resize the disk online. You must update the virtio driver by following the instructions in Step 4 of this topic.

      Query the serial number of a disk

      58017 or later

      You can query the serial number of the disk without the need to update the virtio driver. For more information, see Query the serial number of a disk.

      Earlier than 58017

      You cannot query the serial number of the disk. You must update the virtio driver by following the instructions in Step 4 of this topic.

    View the virtio driver version by querying the corresponding system file

    1. Connect to the Windows ECS instance.

      For more information, see Connect to a Windows instance by using a password or key.

    2. Go to the C:\Windows\System32\drivers directory.

    3. Right-click the viostor.sys file and select Properties. On the Details tab, view the File version parameter.

      Note

      The viostor.sys file is associated with storage device drivers in virtualization environments, specifically for virtual disk controllers on Microsoft Hyper-V virtual machines. When an operating system runs as a virtual machine on a Hyper-V platform, the driver associated with the viostor.sys file works with the virtualization layer of the host to ensure that the guest operating system can read data from and write data to the virtual hard disk like on a physical hard disk. The viostor.sys driver is an important component that ensures virtual machine disk I/O performance and compatibility.

      文件版本号

      Determine whether the virtio driver needs to be updated based on whether the end number of the file version is lower than 58011 or 58017.

      Scenario

      Virtio driver version

      Operation

      Resize a disk online

      58011 or later

      You can resize the disk online without the need to update the virtio driver. For more information, see Step 1: Resize a disk to extend its capacity.

      Earlier than 58011

      You cannot resize the disk online. You must update the virtio driver by following the instructions in Step 4 of this topic.

      Query the serial number of a disk

      58017 or later

      You can query the serial number of the disk without the need to update the virtio driver. For more information, see Query the serial number of a disk.

      Earlier than 58017

      You cannot query the serial number of the disk. You must update the virtio driver by following the instructions in Step 4 of this topic.

    Note

    You can also log on to the Security Center console. On the Vulnerabilities page, click the Windows System Vulnerability tab and check whether the Windows virtio driver BUG causes disk data loss Risk Update vulnerability exists to determine whether you need to update the virtio driver.

    • If the vulnerability does not exist, you do not need to update the virtio driver for Windows instances that belong to your Alibaba Cloud account.

    • If the vulnerability exists, perform one of the following operations:

      • If the Security Center version allows you to detect and fix vulnerabilities, follow the instructions to fix the vulnerabilities. You do not need to perform the subsequent operations in this topic to update the virtio driver. For more information, see View and handle vulnerabilities.

      • If your Security Center version supports vulnerability detection but does not support vulnerability fixing, you must update the virtio driver by following the instructions in Step 4 of this topic.

  4. Update the virtio driver.

    Important
    • The virtio driver update involves updating the network interface controller (NIC) driver. As a result, the network connection may be interrupted for approximately 10 seconds, which may adversely affect your business. We recommend that you assess the risks and make preparations.

    • If the ECS instance has a large number of data disks, the virtio driver update takes 1 minute to 2 minutes to complete.

    You can use one of the following methods to update the virtio driver.

    Use a script to update the virtio driver if the instance can access the Internet

    If the Windows instance can access the Internet, you can use a script to update the virtio driver of your instance.

    1. Connect to the Windows instance whose virtio driver you want to update.

      For more information, see Connect to a Windows instance by using a password or key.

    2. On the Windows instance, download the script used to update the virtio driver.

      Click InstallVirtIo.ps1 to download the InstallVirtIo.ps1 script.

    3. Run the InstallVirtIo.ps1 script to update the virtio driver.

      In this example, the InstallVirtIo.ps1 script is downloaded to the C:\test directory.

      1. Open the C:\test directory.

        Replace C:\test with the actual directory to which you downloaded the InstallVirtIo.ps1 script.

      2. Select and right-click the InstallVirtIo.ps1 script and then select Run with PowerShell.

        执行脚本

        Note
        • If you log on to the Windows instance as a regular user, the regular user must be granted the administrative permissions to run the InstallVirtIo.ps1 script. If you log on as an administrator, you can directly run the script.

        • If you are not allowed to run the InstallVirtIo.ps1 script, you must modify the script execution policy of PowerShell. For more information, see the FAQ section of this topic.

    4. After you run the InstallVirtIo.ps1 script, restart the Windows instance. The new driver version takes effect after you restart the instance.

      For more information, see Restart an instance.

    Update the virtio driver version by using the installation package if the instance cannot access the Internet

    If your Windows instance cannot access the Internet, you can use this method to update the virtio driver.

    1. On the on-premises host, download the virtio driver installation package of the corresponding version based on the actual operating system, and decompress the installation package.

      Click a URL to install the virtio driver. For more information, see the "Procedure" section of the Install the virtio driver topic.

    2. Upload the installation package to the Windows instance.

      For more information, see Upload files to or download files from a Windows instance.

    3. Install the new version of the virtio driver on the Windows instance.

      For more information, see Install the virtio driver.

    Use Cloud Assistant to batch update the virtio drivers on multiple instances

    If you need to update the virtio drivers of multiple ECS instances and the Windows instances can access the Internet or the virtual private clouds (VPCs), you can use Cloud Assistant to batch update the virtio drivers.

    Note

    To batch update virtio drivers by using Cloud Assistant, you must download the required installation package. The system downloads the installation package over the internal network within VPCs. If the package cannot be downloaded over the internal network, the system downloads the package over the Internet.

    1. Log on to the ECS console.

    2. In the left-side navigation pane, choose Maintenance & Monitoring > Cloud Assistant.

    3. In the top navigation bar, select a region.

      The selected region must be the region in which your instances reside.

    4. Use Cloud Assistant to batch update the virtio drivers.

      You use Cloud Assistant to specify the command content or run a common command to update the virtio drivers. The following section describes the different methods for updating virtio drivers by using Cloud Assistant:

      • (Recommended) Use a common command to batch update virtio drivers on multiple ECS instances

        1. On the ECS Cloud Assistant page, click the Common Commands tab and enter ACS-ECS-InstallVirtioDriver-windows.ps1 in the search box to search for the matching command.

        2. In the ACS-ECS-InstallVirtioDriver-windows.ps1 section, click Run.

        3. In the Select Instance section of the Run Command panel, select the IDs of the instances whose virtio drivers need to be updated. Then, click Run.

      • Specify the command content to batch update virtio drivers on multiple ECS instances

        1. On the ECS Cloud Assistant page, click Create/Run Command in the upper-right corner.

        2. In the Create Command panel, configure the parameters.

          • The following table describes the required parameters in the Command Information section. Use the default values for other parameters. For more information, see Create and run a command.

            Parameter

            Description

            Command Source

            Select Enter Command Content.

            Command Type

            Select PowerShell.

            Command content

            You can use one of the following methods to update the virtio drivers:

            • Run the InstallVirtIo.ps1 script to update the virtio drivers.

              You must download the InstallVirtIo.ps1 script to your on-premises computer and copy the entire script to the Command content field.

            • Use a Cloud Assistant plug-in to update the virtio drivers.

              Copy the following command content to the Command content field:

              acs-plugin-manager.exe --exec --plugin=UpdateVirtIo

            Execution Plan

            Select Immediate execution.

          • In the Select Instance section, select the IDs of the instances whose virtio drivers need to be updated.

    5. Click Run.

      You can view the execution results of the command on the Command Execution Result tab. For more information, see the View execution results in the ECS console section of the "Check execution results and troubleshoot common issues" topic. The following figure shows the command output for one of the Windows instances, which indicates that the virtio driver on the instance is successfully updated.云助手更新

    6. Batch restart the Windows instances. After you update the virtio driver on a Windows instance, you must restart the instance to allow the update to take effect.

      For more information, see Restart an instance.

FAQ

  • What do I do if I am not allowed to run a script in PowerShell?

    Solution: For security reasons, PowerShell prohibits running scripts in specific versions of Windows operating systems. You can modify the script execution policy of PowerShell to enable PowerShell to run the script. Perform the following steps:

    1. Run the following command to enable PowerShell to run scripts:

      Set-ExecutionPolicy Unrestricted
    2. Enter A and press the Enter key to modify the script execution policy.

    3. Rerun the script.

    4. To ensure system security, PowerShell returns a warning message in the command output. Enter R and press the Enter key to run the script again.

    5. After the script is run, we recommend that you run the following command to restore the default configurations of PowerShell to ensure system security:

      Set-ExecutionPolicy Restricted
    6. Enter A and press the Enter key to modify the script execution policy.

  • What do I do if I am prompted that no digital signature is available for the NIC driver after the virtio driver is updated?

    You can manually download the latest Windows driver package to replace the faulty NIC driver. Perform the following steps:

    1. Connect to the Windows instance.

      For more information, see Connect to a Windows instance by using a password or key.

    2. Click Windows driver package to download the latest Windows driver package.

      Note

      If you cannot download the driver package to your Windows instance, you can download the driver package to an on-premises host. Then, use Remote Desktop Connection or an FTP site to upload the driver package to the Windows instance. For information about how to build an FTP site, see Build an FTP site on a Windows instance.

      After the package is downloaded, find the new_virtio.zip driver package.

    3. Decompress the Windows driver package and open the new_virtio folder.

      In the folder, find the subfolders that correspond to different Windows versions.

      image

      These subfolders contain the virtio driver installation files for the corresponding Windows versions. Take note of the following subfolders:

      • win10: This subfolder contains an amd64 subfolder that stores driver installation files for Windows Server 2016, Windows Server 2019, and Windows 10.

      • Win8: This subfolder contains an amd64 subfolder that stores driver installation files for Windows Server 2012 R2 and Windows 8.1.

      • win7: This subfolder contains an amd64 subfolder that stores driver installation files for Windows Server 2008 R2 and Windows 7.

    4. Uninstall the NIC driver of the Windows instance.

      In this example, Windows Server 2019 64-bit is used. You can perform similar steps for other Windows operating system versions.

      1. Open Windows Control Panel. In the Search Control Panel search box, enter Device Manager.设备管理器

      2. Click Device Manager.

      3. Click Network adapters and right-click Red Hat VirtIO Ethernet Adapter.

      4. Click Uninstall device.卸载设备

      5. In the Confirm Device Removal dialog box, select Delete the driver software for this device and click OK.

        If the Red Hat VirtIO Ethernet Adapter is no longer displayed in Device Manager, the NIC driver is uninstalled.

    5. Install the latest Windows NIC driver.

      1. In Windows PowerShell, run the following command to open the corresponding Windows driver folder.

        In this example, Windows Server 2019 64-bit is used, and the Windows driver package is stored in the C:\test directory. Therefore, the directory is C:\test\new_virtio\win10\amd64.

        cd C:\test\new_virtio\win10\amd64
      2. In the PowerShell window, run the following command to install the latest Windows NIC driver:

        pnputil -i -a netkvm.inf

        The following figure shows that the NIC driver is installed.安装网卡驱动

    6. Return to or reopen Device Manager, right-click the hostname, and then click Scan for hardware changes.

      In this example, the hostname of the Windows instance is test, as shown in the following figure.扫描检测

      After the scan is complete, the NIC driver is displayed in Device Manager.

    7. View information about the latest NIC driver.

      1. Click Network adapters and right-click Red Hat VirtIO Ethernet Adapter.

      2. Click Properties.

      3. In the Red Hat VirtIO Ethernet Adapter Properties dialog box, click the Driver tab to view the virtio driver information.

        image

    8. Restart the Windows instance. After you restart the Windows instance, the virtio driver update takes effect.

      For more information, see Restart an instance.

References