Before you perform a backup operation for virtual machines that you plan to convert, make changes to the source VMs to ensure that they can be converted successfully. If you encounter errors while executing the required scripts, refer to the KB article "Access denied error during script Execution when Converting Windows VM to GCP for ContentStore Upload article 80244".
Note
-
For Windows operating system, you can use a PowerShell script to automatically prepare VMs for conversion to Google Cloud Platform. For more information, see Using a Script to Prepare VMs for Conversion to Google Cloud Platform.
-
For Linux operating system, you can use a script to skip manual installation of Google Cloud Platform (GCP) drivers on Linux VMware virtual machines for conversion to GCP. For more information, see Using a Script to Skip Manual Installation of Google Cloud Platform Drivers.
Before You Begin
-
For the Windows operating systems of guest Amazon, Azure Resource Manager, and VMware VMs, download the vioscsi.inf, netkvm.inf Windows driver files.
-
For the Linux operating systems of guest Azure Resource Manager and VMware VMs, download the virtio drivers (preloaded with Linux).
Procedure
Make the following changes to source VMs:
-
For Windows VMs that are running in Amazon, Azure Resource Manager, and VMware, download and install GooGet PowerShell as follows:
-
Download and install GooGet by running the following commands in an elevated PowerShell version 3.0 or higher prompt:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest https://github.com/google/googet/releases/download/v2.13.0/googet.exe -OutFile $env:temp\googet.exe; & "$env:temp\googet.exe" -root C:\ProgramData\GooGet -noconfirm install -sources https://packages.cloud.google.com/yuck/repos/google-compute-engine-stable googet; Remove-Item "$env:temp\googet.exe"
During installation, GooGet adds content to the system environment. After installation completes, launch a new PowerShell console or provide the full path to the googet.exe file (C:\ProgramData\GooGet\googet.exe).
-
Open a new console and then add the google-compute-engine-stable repository by running the following command:
.\googet.exe -root C:\ProgramData\GooGet addrepo google-compute-engine-stable https://packages.cloud.google.com/yuck/repos/google-compute-engine-stable
-
Run the following commands to download VioSCSI and NetKVM drivers:
.\googet.exe -root C:\ProgramData\GooGet download google-compute-engine-driver-netkvm
.\googet.exe -root C:\ProgramData\GooGet download google-compute-engine-driver-vioscsi
-
Extract the downloaded files using 7Zip, and then install the drivers as described in Step 2a through Step 2d, below.
-
-
For Windows VMs that are running in Amazon, Azure Resource Manager, and VMware, inject drivers for the SCSI controller (vioscsi) and network adapter (netkvm) to ensure that the Google Cloud Platform instance can start after conversion. The vioscsi driver is required for the Windows boot process.
-
Perform the following steps for both of the driver files (vioscsi.inf and netkvm.inf):
-
Go to Run and execute hdwwiz.exe to open the Add New Hardware wizard.
-
Select the Install the hardware that I manually select from a list option.
-
As the hardware type, select Show All Devices.
-
Click Have Disk.
The Install from Disk dialog box appears.
-
Browse and select the driver file, and then click OK.
-
Click Next to continue, click Next again to start installing the driver, and then click Finish when the installation completes.
-
-
From Windows Explorer, right-click the vioscsi.inf file, and then click Install.
-
From Windows Explorer, right-click the netkvm.inf file, and then click Install.
-
To add the VirtIO SCSI controller to the CriticalDeviceDatabase, add the following registry key to the Windows registry hive:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#VEN_1AF4&DEV_1004&SUBSYS_00081AF4&REV_00] "ClassGUID"="{4D36E97B-E325-11CE-BFC1-08002BE10318}" "Service"="vioscsi"
Note
"ClassGUID" and "Service" are string values.
Note that, if the CriticalDeviceDatabase folder does not already exist, create one as follows:
-
Open the Windows Registry Editor, and then go to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet directory.
-
Right-click Control, and then click New > Key.
-
Name the new key CriticalDeviceDatabase.
-
Close the Registry Editor.o
-
-
-
For Linux VMs, ensure that the following modules are configured to be available during the boot process: virtio, virtio_ring, virtio_pci, virtio_net, virtio_scsi. Although commonly used Linux distributions (CentOS, RHEL, OpenSUSE, Ubuntu) will have these virtio driver modules packaged, you should still ensure that they are configured to be available.
-
To check whether the required modules are built into the kernel itself, run the following command:
grep -i virtio /boot/config-$(uname -r)
Look for values of CONFIG_VIRTIO, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_NET, and CONFIG_SCSI_VIRTIO.
If a virtio driver’s line says y, the driver is built into the kernel and it will be available by default during the boot process.
If a virtio driver’s line says m, the driver needs to be part of the initial RAM disk.
-
Check if the drivers are part of the initial ramdisk, as follows:
-
For CentOS, RHEL, or OpenSUSE, run the following command:
lsinitrd | grep -i virtio
-
For Ubuntu, run the following command:
lsinitramfs /boot/initrd.img-$(uname -r) | grep -i virtio
-
-
If any driver is missing from both the kernel and the initial ramdisk, rebuild the initial ramdisk to include the missing modules, as follows:
-
For CentOS, RHEL, or OpenSUSE, create a backup of the current initial ramdisk image by running the following command:
cp /boot/
<Current_Image_Name>/boot/
<Current_Image_Name>.backup
Where:
- (For CentOS and RHEL): <Current_Image_Name> = initramfs-$(uname -r).img
- (For OpenSUSE): <Current_Image_Name> = initrd-$(uname -r)
-
Edit the dracut.conf file by running the following command:
vi /etc/dracut.conf
-
Add the following line to the dracut.conf file. If the line already exists as a commented line, uncomment the line and then add the drivers to the line, with spaces separating each driver:
add_drivers+=" virtio virtio_ring virtio_pci virtio_scsi virtio_net "
Note
-
Note the whitespaces before and after the drivers.
-
Add only the required drivers.
-
If the VM kernel version is later than 3.6, do not include
virtio_ring
.
-
-
Go to the boot folder by running the following command:
cd /boot
-
Recut the initial ramdisk image by running the following command:
dracut -f -v
-
List the initial ramdisk image contents and verify that the virtio drivers were added, by running the following command:
lsinitrd | grep -i virtio
-
-
-
Since the network interface names on VMware and GCP are different, this might cause an issue after the restore. Therefore, it is recommended to run the following command on the source VM:
execute 'nmcli device connect <network interface name>'
-
Perform a backup operation for the modified source VMs.