Planing on converting physical disk to a VMware image, then convert to qemu(kvm) image for booting o


Updated on 8th March 2021

Successfully I migrated a x86_64 Linux OS for work to a Virtual machine which can be ran on ARM64 M1 Macbook Pro.

I will address the tutorial in another blog.

----------------------

On going.

Devices needed:

1. the hard drive installed a x86 linux os

2. an OS running VMware Converter from here called "vCenter converter": https://www.vmware.com/products/converter.html

3. M1 Macbook Pro

-----

Useful tutorials: https://kevrocks67.github.io/blog/running-vmware-images-in-qemu.html

-----

Psuedo steps

1. Install vCenter Converter on a x86 Linux machine. And derive a VMWare image from a physical hard drive installed a x86 Linux. Let's call the image linuxbox.vmdk

2. On M1 macbook pro, use tool

qemu-img convert -f vmdk -O qcow2 linuxbox.vmdk linuxbox.qcow2

3. Start the linuxbox.qcow2 image from a qmeu command on a M1 macbook Pro.

-----

Quick test ( it works!!! )

1. Download a VMDK x86 linux from a site: https://www.osboxes.org/ubuntu/#ubuntu-20-04-vmware

2. convert it using qemu-image covert

3. run it

Edited in 3rd March 2021, 

It works!!!

-----

info about tranforming virtual machine files to qemu files can be found here: https://docs.openstack.org/image-guide/convert-images.html

qemu-img convert: raw, qcow2, qed, vdi, vmdk, vhd?

The qemu-img convert command can do conversion between multiple formats, including qcow2, qed, raw, vdi, vhd, and vmdk.

qemu-img format strings?

Image format

Argument to qemu-img

QCOW2 (KVM, Xen)

qcow2

QED (KVM)

qed

raw

raw

VDI (VirtualBox)

vdi

VHD (Hyper-V)

vpc

VMDK (VMware)

vmdk

This example will convert a raw image file named image.img to a qcow2 image file.

$ qemu-img convert -f raw -O qcow2 image.img image.qcow2

Run the following command to convert a vmdk image file to a raw image file.

$ qemu-img convert -f vmdk -O raw image.vmdk image.img

Run the following command to convert a vmdk image file to a qcow2 image file.

$ qemu-img convert -f vmdk -O qcow2 image.vmdk image.qcow2
 

Note

The -f format flag is optional. If omitted, qemu-img will try to infer the image format.

When converting an image file with Windows, ensure the virtio driver is installed. Otherwise, you will get a blue screen when launching the image due to lack of the virtio driver. Another option is to set the image properties as below when you update the image in the Image service to avoid this issue, but it will reduce virtual machine performance significantly.

$ openstack image set --property hw_disk_bus='ide' image_name_or_id

-----

It works.

CPU Performance

qemu virtual machine benchmark

CPU 8 Cores
RAM 4GB
OS Ubuntu 20.04 x86_64

Performance is about 25% of the desktop CPU intel i7 8700K (6 cores 12 threads CPU)

I would say impressive!

The only problem about qemu on M1 is that hardware accleration isn't suppored (yet). Such as M1 chip's graphics, neural network processing cores, and some unknown features. I find the window movement is so laggy when using Gnome 3 x86_64 Linux on M1.

M1 mac ships with 8 graphic cores, 16 neural network processing cores. So delicious! Don't waste them, yummy yummy.

Good luck!