Converting the RHEL7.6 VM image to VHD
Pre-requisites:
Source VM OS volume must use MBR partitioning rather than GPT.
Use the persistent naming (file system label or UUID) in
fstabconfiguration.Most distributions provide the fstab nofail or nobootwait parameters. These parameters enable a system to boot when the disk fails to mount at startup.
Ensure that the operating system is installed on the first disk of the source VM. Do not configure a swap partition on the operating system disk. See Information for Non-endorsed Distributions.
We recommend that the network interface in the 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 the
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 enable it on boot.
In the network interface configuration file, configure: ONBOOT=yes.
For example,
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 the image sharing server and configure the image sharing feature with Azure account.
- Import the backup image and perform the conversion.
- Verify the converted vhd files.
In the 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.
Log in to the converted VM through RDP.