Converting the VM image to VHD in Azure
Windows 2016
To convert the Windows 2016 VM image to VHD
- Enure that you enable Remote Desktop Connection on your source VM before backup.
- Perform a new full backup of the source VM,
- Prepare image sharing server and configure image sharing feature with azure account.
- Import the backup image and perform the conversion.
- Verify the converted vhd files.
In Azure web Portal:
Create a disk with the converted .vhd file
Create a VM with the previous disk.
Navigate to Disks > Created disk > Create VM. With default Networking & Disks & Management settings, enable boot diagnostics.
Login the converted VM through RDP.
RHEL7.6
Pre-requisites:
Source VM OS volume must use MBR partitioning rather than GPT.
It is recommended that persistent naming is used and the filesystem label or UUID for Azure Linux VMs is used.
Most distributions provide the fstab nofail or nobootwait parameters. These parameters enable a system to boot when the disk fails to mount at startup.
Enure that OS is installed on the first disk of source VM and do not configure a swap partition on the operating system disk. see Information for Non-endorsed Distributions.
It is recommended that the network interface in source VM uses DHCP and enabled on boot. See Add, change, or remove IP addresses for an Azure network interface.
To convert the RHEL7.6 VM image to VHD
- Install latest LIS 4.3.5.
tar -xzf lis-rpms-4.3.5.x86_64.tar.gz
cd LISISO
./install
reboot
- Rebuild
initramfsimage file.cd /boot
cp initramfs-`uname -r`.img initramfs-`uname -r`.img.bak
Run the following command to open
dracut.conffile:vi /etc/dracut.conf
Uncomment the line #add_drivers+=""
Add the following drivers to the line, separating each module with the space.
hv_netvsc hv_storvsc hv_vmbus
Example,
# additional kernel modules to the default. add_drivers+="hv_netvsc hv_storvsc hv_vmbus"
Create new initial ramdisk images with new modules.
dracut -f -v -N
Run any of the following commands to check if the new modules exist in new initial ramdisk images.
lsinitrd | grep -i hv
lsinitrd -f /boot/initramfs-`uname -r`.img | grep -i hv
modinfo hv_netvsc hv_storvsc hv_vmbus
- Rename the network interface to eth0 and enabled on boot. After this change, reboot VM to check if eth0 works.
In the network interface configuration file, configure: ONBOOT=yes.
The example to change the network interface to eth0:
mv /etc/sysconfig/network-scripts/ifcfg-ens192 /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ens192/eth0/g' /etc/sysconfig/network-scripts/ifcfg-eth0
In the file
/etc/default/grub, change the line GRUB_CMDLINE_LINUX="xxxxxxx" to GRUB_CMDLINE_LINUX="xxxxxxx net.ifnames=0 biosdevname=0"grub2-mkconfig -o /boot/grub2/grub.cfg
- Perform a new full backup of the source VM,
- Prepare image sharing server and configure image sharing feature with azure account.
- Import the backup image and perform the conversion.
- Verify the converted vhd files.
In Azure web Portal:
Create a disk with the converted .vhd file
Create a VM with the previous disk.
Navigate to Disks > Created disk > Create VM. With default Networking & Disks & Management settings, enable boot diagnostics.
Login the converted VM through RDP.
SUSE 12 SP4
Pre-requisites:
Source VM OS volume must use MBR partitioning rather than GPT.
It is recommended that persistent naming is used and the filesystem label or UUID for Azure Linux VMs is used.
Most distributions provide the fstab nofail or nobootwait parameters. These parameters enable a system to boot when the disk fails to mount at startup.
Enure that OS is installed on the first disk of source VM and do not configure a swap partition on the operating system disk. see Information for Non-endorsed Distributions.
It is recommended that the network interface in source VM uses DHCP and enabled on boot. See Add, change, or remove IP addresses for an Azure network interface.
To convert the SUSE 12 SP4 VM image to VHD
- Make sure the required modules are installed.
lsinitrd -f /boot/initramfs-`uname -r`.img | grep -i hv
or
modinfo hv_vmbus hv_storvsc hv_netvsc
reboot
Rebuild initrd.
cd /boot/
cp initrd-$(uname -r) initrd-$(uname -r).backup
mkinitrd -v -m "hv_vmbus hv_netvsc hv_storvsc" -f /boot/initrd-$(uname -r) $(uname -r)
- Check the network interface name eth0 and enabled on boot.
/etc/sysconfig/network/ifcfg-eth0 contains the record:
STARTMODE='auto'
- Perform a new full backup of the source VM,
- Prepare image sharing server and configure image sharing feature with azure account.
- Import the backup image and perform the conversion.
- Verify the converted vhd files.
In Azure web Portal:
Create a disk with the converted .vhd file
Create a VM with the previous disk.
Navigate to Disks > Created disk > Create VM. With default Networking & Disks & Management settings, enable boot diagnostics.
Login the converted VM through RDP.