nbdkit is our high performance liberally licensed Network Block Device server, and OVA files are a common pseudo-standard for exporting virtual machines including their disk images.
A .ova file is really an uncompressed tar file:
$ tar tf rhel.ova rhel.ovf rhel-disk1.vmdk rhel.mf
Since tar files usually store their content unmangled, this opens an interesting possibility for reading (or even writing) the embedded disk image without needing to unpack the tar. You just have to work out the offset of the disk image within the tar file. virt-v2v has used this trick to save a copy when importing OVAs for years.
nbdkit has also included a tar plugin which can access a file inside a local tar file, but the problem is what if the tar file doesn’t happen to be a local file? (eg. It’s on a webserver). Or what if it’s compressed?
To fix this I’ve turned the plugin into a filter. Using nbdkit-tar-filter you can unpack even non-local compressed tar files:
$ nbdkit curl http://example.com/qcow2.tar.xz \ --filter=tar --filter=xz tar-entry=disk.qcow2
(To understand how filters are stacked, see my FOSDEM talk from last year). Because in this example the disk inside the tarball is a qcow2 file, it appears as qcow2 on the wire, so:
$ guestfish --ro --format=qcow2 -a nbd://localhost Welcome to guestfish, the guest filesystem shell for editing virtual machine filesystems and disk images. Type: ‘help’ for help on commands ‘man’ to read the manual ‘quit’ to quit the shell ><fs> run ><fs> list-filesystems /dev/sda1: ext2 ><fs> mount /dev/sda1 / ><fs> ll / total 19 drwxr-xr-x 3 root root 1024 Jul 6 20:03 . drwxr-xr-x 19 root root 4096 Jul 9 11:01 .. -rw-rw-r--. 1 1000 1000 11 Jul 6 20:03 hello.txt drwx------ 2 root root 12288 Jul 6 20:03 lost+found