Overview
This document uses Windows Server 2012 as an example to guide you through the process of creating a Windows image. If you are using a different version of the Windows Server operating system, you can still refer to this document for image creation.
Prerequisites
Before performing the operation, ensure that you have prepared a virtual machine and have installed the Windows operating system (Windows Server 2012 is used as an example in this document).
Preparations
Checking the Partitioning and Starting Mode of the Operating System
Note:
If you need to create and export a data disk image, skip this step.
Checking the Partitioning and Starting Mode of the Operating System
1. On the desktop, click to open the Windows PowerShell window. 2. In the Windows PowerShell window, enter diskmgmt.msc and click Enter to open the Disk Management window.
3. Right-click the disk you need to check and then choose Properties.
4. Select the Volume tab to view the disk partition.
5. Check whether the disk partition is a GPT partition.
If yes, as GPT partitions are not available for service migration, please submit a ticket. If no, proceed to the next step.
6. Start CMD as the admin user and run the following command to check whether the operating system starts in EFI mode:
A result similar to the following will be returned:
Windows boot loader
ID {current}
device partition=C:
path \\WINDOWS\\system32\\winload.exe
description Windows 10
locale zh-CN
inherit {bootloadersettings}
recoverysequence {f9dbeba1-1935-11e8-88dd-ff37cca2625c}
displaymessageoverride Recovery
recoveryenabled Yes
flightsigning Yes
allowedinmemorysettings 0x15000075
osdevice partition=C:
systemroot \\WINDOWS
resumeobject {1bcd0c6f-1935-11e8-8d3e-3464a915af28}
nx OptIn
bootmenupolicy Standard
If the path parameter contains "efi", the current operating system is started in EFI mode. In this case, please submit a ticket. If path does not contain "efi", proceed to the next step.
Uninstalling Conflicting Drivers and Software
Uninstall the conflicting drivers and software (including VMware tools, Xen tools, Virtualbox GuestAdditions, and other software that comes with underlying drivers).
Directions
Step 1: Installing cloud-base
Step 2: Verifying or Installing VirtIO Drivers
Choose Control panel > Programs and Features and enter "Virtio" in the search box.
If the result shown in the figure below is returned, the Virtio driver is installed.
If the Virtio driver is not installed, please download an edition based on your needs and install it.
Note:
Tencent Cloud does not support importing Windows Server 2003.
If you are using Windows Server 2008R2/2012R2/2016/2019/2022, please install Tencent Cloud customized VirtIO driver.
If you are using another version of Windows operating system, please try Tencent Cloud customized VirtIO driver first. If the running is not stable, install the community edition instead.
Installing Tencent Cloud customized VirtIO driver (recommended)
Installing community edition of VirtIO driver
The download addresses are as below:
Public network download address: http://mirrors.tencent.com/install/windows/virtio_64_1.0.9.exe
Private network download address: http://mirrors.tencentyun.com/install/windows/virtio_64_1.0.9.exe
Checking Other Hardware Configurations
After the migration to the cloud, hardware changes include but are not limited to:
The graphics card has been changed to Cirrus VGA. ( Path: Computer Management > Device Manager > Display adapters )
The disk has been changed to VirtIO disk. ( Path: Computer Management > Device Manager > Disk Drives )
The Elastic Network Interface (ENI) has been changed to VirtIO NIC and local area connection is used by default. (Path: Computer Management > Device Manager > Network adapter)
Step 3: Exporting the Image File Using the Disk2vhd Tool
2. Install and run Disk2vhd.
Note:
Install and run Disk2vhd on a non-system disk.
Disk2vhd can be started only after the Volume Shadow Copy Service (VSS) is installed in the Windows system. For more information about the VSS features, see Volume Shadow Copy Service. 3. Configure the parameters as below and click Create to export the image.
Use Vhdx: Do not select it because the system currently does not support VHDX images.
Use volume Shadow Copy: It is recommended that you select it for higher data integrity.
VHD File name: The location where the .vhd file is stored. Please select a non-system disk.
Volume to include: The entire system disk is required to be exported when you export the image. Please choose all partitions of your system disk, otherwise an error will occur when you import the image.
System disk partitions usually include C:\\ partition, boot partition and recovery partition. All partitions need to be chosen.
Configuration samples
Run Disk2vhd in E drive, choose all partitions of the system disk (boot partition and C:\\ partition). Select "Use volume Shadow Copy" and deselect "Use Vhdx". The .vhd file will be stored on E drive after the image is exported.
Step 4: Checking the Image
Note:
The image file system that you create may be corrupted because you created the image without stopping the service or due to other reasons. Therefore, we recommend that you check the image after creating it.
If the image format is supported by the current platform, you can directly open the image to check the file system. For example, the Windows platform supports images in the vhd format; the Linux platform allows you to use qemu-nbd to open images in the qcow2 format; and the Xen platform allows you to directly open files in the vhd format.
This document takes checking the VHD images through Attach VHD in Disk Management on Windows as an example.
1. On the desktop, right click and select Computer Management in the pop-up menu. 2. Select Storage > Disk Management to enter the disk management page.
3. Select Action > Attach VHD as shown in the figure below.
If the result similar to the following figure appears, the image has been created.
FAQs
How Do I Convert Image Formats?
Note:
Currently, Tencent Cloud Virtual Machine (CVM) migration supports images in the following formats: qcow2, vhd, raw, and vmdk.
If the image exported using other tools does not match the above formats, refer to Converting Image Format and use qemu-img
to convert the image file format to a supported format.
Was this page helpful?