I don’t really import VMs via OVA to my hypervisor. I tend to install from the ISO file. With the COVID-19 quarantine going on, I thought it would be a best time to learn Red Hat and may attempt to take the RHCSA 8 exam. To do this, I would need a lab. The quickest way would be to import a VM to my Proxmox box.
I used to scp upload the .ova file to Proxmox and extracted the contents of the .ova file; qemu convert the .vmdk file into .qcow2 then
dd the .qcow2 file to the blank VM. The blank VM need to be created in the web UI prior to
dd. I recently found out that importing a .ova file to Proxmox got easier via the
qm importovf command. Like I mentioned a minute ago, I don’t import VM that often; this post is to document how import an OVA file to Proxmox.
The command is very simple.
qm importovf <vm-id> <ovf-file> <storage-name>
Let’s setup the environment for this post.
- Proxmox server – 192.168.7.32
- OVA file – librenms-ubuntu-18.04-amd64.ova
- VM ID – 333
Upload the OVA file to the Proxmox server. I’ll be using SCP.
scp librenms-ubuntu-18.04-amd64.ova firstname.lastname@example.org:/root/
Extract the contents of the OVA file. The content that we need here is the .ovf file.
root@pve1:~# tar xvf librenms-ubuntu-18.04-amd64.ova root@pve1:~# ls -l total 3208652 -rw-rw---- 1 games bin 1642814976 Nov 3 07:25 librenms-ubuntu-18.04-amd64-disk001.vmdk -rw-r----- 1 games bin 173 Nov 3 07:27 librenms-ubuntu-18.04-amd64.mf -rw-r--r-- 1 root root 1642824192 Nov 3 07:28 librenms-ubuntu-18.04-amd64.ova -rw-r----- 1 games bin 6690 Nov 3 07:25 librenms-ubuntu-18.04-amd64.ovf
Once the .ovf file has been extracted from the .ova file, we need to execute the
qm importovf 333 librenms-ubuntu-18.04-amd64.ovf pve1_local_zfs
What is about to happen here is Proxmox will read the .ovf file and will create the VM based on the .ovf file information. Proxmox will assign the VM-ID of 333 to the VM and put the VM in pve1_local_zfs.
The new VM with VM-ID of 333 should show up in the web UI. Hope you’ll find this useful.
Here is an update to this post: (I changed the original VM ID from 304 to 333 to reflect the screenshots)
If you get an error as shown in the snippet below, the VM configuration will still get imported to Proxmox, but without a disk. We would need to import the vmdk disk that came with the OVA file.
warning: unable to parse the VM name in this OVF manifest, generating a default value invalid host ressource /disk/vmdisk1, skipping
To import the VMDK file can be done two ways: Import the converted version or use the option
--format. The easier way would be to use the –format option followed by the desired format which is qcow2 as shown below. The format options are raw, qcow2 and vmdk.
root@pve1:~# qm importdisk 333 librenms-ubuntu-18.04-amd64-disk001.vmdk pve1_local_zfs --format qcow2
Another way of importing a disk is converting the vmdk file into qcow2 format.
# Convert the vmdk file to qcow2 root@pve1:~# qemu-img convert -f vmdk -O qcow2 librenms-ubuntu-18.04-amd64-disk001.vmdk librenms-ubuntu-18.04-amd64-disk001.qcow2 # Import the disk into the VM root@pve1:~# qm importdisk 333 librenms-ubuntu-18.04-amd64-disk001.vmdk pve1_local_zfs
Either methods would accomplish the task. Once done, navigate back to the web UI and edit the VM’s Hardware > Unused Disk 0 (as shown in Figure 1) and change the Bus/Device from IDE to either SATA, VirtIO or iSCSI.
The name Unused Disk 0 will change to Hard Disk as shown in Figure 2.
While the VM is powered down, might as well change its name from VM333 to something that make sense. This can be done in VM’s Options > Name