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
(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.
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.
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
Connect to the Windows instance.
For more information, see Connect to a Windows instance by using a password or key.
Open the Run dialog box.
Enter powershell and click OK to start PowerShell.
Run the following command to check the virtio driver version:
[System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Windows\System32\drivers\viostor.sys")
NoteThe
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.
Determine whether the virtio driver needs to be updated based on whether the end number of the ProductVersion value is lower than
58011
or58017
.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
Connect to the Windows ECS instance.
For more information, see Connect to a Windows instance by using a password or key.
Go to the C:\Windows\System32\drivers directory.
Right-click the viostor.sys file and select Properties. On the Details tab, view the File version parameter.
NoteThe
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
or58017
.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.
NoteYou 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.
Update the virtio driver.
ImportantThe 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.
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.
On the Windows instance, download the script used to update the virtio driver.
Click InstallVirtIo.ps1 to download the InstallVirtIo.ps1 script.
Run the InstallVirtIo.ps1 script to update the virtio driver.
In this example, the InstallVirtIo.ps1 script is downloaded to the C:\test directory.
Open the C:\test directory.
Replace C:\test with the actual directory to which you downloaded the InstallVirtIo.ps1 script.
Select and right-click the InstallVirtIo.ps1 script and then select Run with PowerShell.
NoteIf 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.
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.
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.
Upload the installation package to the Windows instance.
For more information, see Upload files to or download files from a Windows instance.
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.
NoteTo 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.
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select a region.
The selected region must be the region in which your instances reside.
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
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.In the
ACS-ECS-InstallVirtioDriver-windows.ps1
section, click Run.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
On the ECS Cloud Assistant page, click Create/Run Command in the upper-right corner.
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.
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.
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
References
For information about how to resize a disk online, see Step 1: Resize a disk to extend its capacity.
For information about how to query the serial number of a disk, see Query the serial number of a disk.