← 返回列表

Notes on using Incus to run a .OVA file

单站 Graham Helton 发布 2024-11-30T00:00:00.000Z 入库 2026-11-18T05:21:09

Incus

Recently I’ve been exploring Incus as a quick and
lightweight VM/container hosting solution. One of the requirements I had
for Incus was to quickly run a .ova file within it. It’s
not too difficult to pull off, but the resources out there were sparse
so I’ve put together a quick guide on how to do it.

Quick Primer: VMDK vs RAW vs OVA vs OVF vs ISO vs qcow2

VMs are sometimes a pain to use, especially since VMware workstation has regressed in usability since being acquired by Broadcom, this is not helped by the fact that there is a lot of jargon that means different things to different people. Here is a quick recap of some of the differences in VM image types.

OVF: Open Virtualization Format (OVF) is a standard
for packaging virtual machine configuration files. This standard
describes contains a few files:

OVA Files: Essentially a tar of various files
described in the Open Virtualization Format (OVF) needed for virtual
machines to work. If we look at the .ova file I will be
converting we can verify that after running
tar xvf NetWars_Continuous_2.0.3_2019-11-25.ova, we can see
the files were extracted:

VMware-SANS-nostromo-2019-11-25_1835.ovf
VMware-SANS-nostromo-2019-11-25_1835-disk1.vmdk
VMware-SANS-nostromo-2019-11-25_1835.mf

We can take a look at contents of the files that are plain-text files
by using the following commands:
file * | grep ASCII | cut -d" " -f 1 | sed s/://g | xargs batcat --pager=never

VMDK Files: Previously owned by VMware, VMDK files
are typically used with VMware products and allow for features such as
snapshots. VMDK files are essentially the contents of a hard drive
mapped to a single file.

RAW files: Files with the .raw extension are
“unformated” disk files. These files have no underlying metadata
associated with them. They’re big, simple, and have less extra features
that can cause issues if you’re doing odd things with them. Due to not
having any smart features built in, they’re not very efficient when it
comes to storage and they don’t naively support snapshots without using
third party tooling such as Incus.

Qcow2 Files: Qcow2 (QEMU Copy On Write Version 2)
has many additional features such as storage efficiency, native
snapshotting features, etc. These features make them much more complex
to work with.

ISO Files: A format for CD images widely used by
Linux operating systems. It contains everything that would be written to
a CD, great for installing operating systems.

How to upload an OVA to

Incus

These steps were performed on an Ubuntu 24.04 machine running Incus.
While the steps should work for other distributions, they have
not been tested.

  1. Install the required qemu package that will allow for conversion of
    .vmdk to .raw:

  2. Download The incus-migrate tool from
    github releases page. Look for bin.linux.incus.x86x64 (Or
    whatever architecture you’re running on).

  3. Download your .ova file to a directory and move into
    it.

  4. Untar the .ova using tar:

  1. Set $VMDK to the .vmdk file and convert
    the .vmdk file to .raw (Optional But
    Recommended, this will be done anyway once uploading)

  2. Migrate .vmdk to Incus. this will actually upload the
    VM disk image into incus.

Is the local server the target?: Yes
Create VM: 1
Insert path to raw: ~/scratchpad/imagename.raw

That’s it. Your .OVA file will now be usable inside of Incus.

Optional

  1. Depending on the size of the OVA, you may want to retroactively add more storage to the VM. Within the Incus WebUI, additional disk storage space can be allocated if needed.

A connection to the VM console can be made by running
sudo incus console <image_name> -t vga. You may need
to install some dependencies first:

OVA Running In Incus

原文链接:https://grahamhelton.com/blog/incus-ova.html