KVM not recognizing disks in qcow2 format (TrueNAS Scale)

Joined
Aug 8, 2021
Messages
1
On my existing KVM servers, which run ubuntu 16.04, I am able to build a new VM and point at an existing VM disk, which is in qcow2 format and boot that OS disk without any trouble. I tried to do the same thing with TrueNAS scale, but am not having much luck. I create a new VM, then go back and point at the qcow2 file, which is a known good linux OS VM file, but it is not recognized as such by the TrueNAS scale Virtualization app. Is this to be expected with the current beta release and do we know if this is addressed in the 21.08 beta release?

I have had luck with building new VMs from scratch under TrueNAS scale and I am just looking to save a lot of work for myself if there is some way I can import/use those existing qcow2 files from my KVM box.

Thank you
 

ro55_mo

Dabbler
Joined
Feb 3, 2018
Messages
16
Don't suppose you got this working? I am looking to essentially do the same thing. Admittedly I am going to be using TrueNAS-SCALE-22.02.4
 

HoneyBadger

actually does care
Administrator
Moderator
iXsystems
Joined
Feb 6, 2014
Messages
5,112
TrueNAS SCALE is currently set up to use ZVOLs for virtual machines instead of files.

You can create a new ZVOL of the correct size, and then convert the image file with this command

qemu-img convert -O raw /path/to/your.file > /dev/zvol/poolname/zvolname
 

ro55_mo

Dabbler
Joined
Feb 3, 2018
Messages
16
Thanks for the confirmation. I am planning to reorganize my vdev's as well. So I will be backing up all my content and dumping out my VMs to file before destroying my Core installation, then rebuilding fresh with Scale.
 

alveolina

Dabbler
Joined
Jan 8, 2023
Messages
11
TrueNAS SCALE is currently set up to use ZVOLs for virtual machines instead of files.

You can create a new ZVOL of the correct size, and then convert the image file with this command

qemu-img convert -O raw /path/to/your.file > /dev/zvol/poolname/zvolname

Alright, so this thread suggests I may be able to solve my problem. I have a VM (qcow2) running on Proxmox. I've just set up a Truenas Scale server so I can recycle the hardware where Proxmox is installed. The VM on Proxmox is running services I can't do without so my intention is to convert that qcow2 image so that it can be read by Truenas.

The above command suggests that I would need to:
a) create a new dataset on my existing zvol named zeus2p1
b) create a new dataset called "vmachine"
c) copy the qcow2 image to another dataset on the Truenas machine
d) run the above command on the Truenas machine via ssh

Are the above steps right?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
a) create a new dataset on my existing zvol named zeus2p1
b) create a new dataset called "vmachine"
c) copy the qcow2 image to another dataset on the Truenas machine
d) run the above command on the Truenas machine via ssh

Are the above steps right?
No.

That's the path to an existing zvol, so what you do is create the zvol and then specify the path (via devices, not datasets) to it. Steps c and d are OK.
 

HoneyBadger

actually does care
Administrator
Moderator
iXsystems
Joined
Feb 6, 2014
Messages
5,112
Alright, so this thread suggests I may be able to solve my problem. I have a VM (qcow2) running on Proxmox. I've just set up a Truenas Scale server so I can recycle the hardware where Proxmox is installed. The VM on Proxmox is running services I can't do without so my intention is to convert that qcow2 image so that it can be read by Truenas.

The above command suggests that I would need to:
a) create a new dataset on my existing zvol named zeus2p1
b) create a new dataset called "vmachine"
c) copy the qcow2 image to another dataset on the Truenas machine
d) run the above command on the Truenas machine via ssh

Are the above steps right?
I think there's a bit of confusion about the name of ZFS components - what you need to do is

a) create a new ZVOL (ZFS Volume) on your existing pool (ZFS main storage component)
b) no need for a new dataset, unless you need one as a "landing zone" for the .qcow2 file
c) and d) as above
e) create the new VM, use the same definitions for OS type, CPU/memory, and in step 3 choose "Use existing disk image" as shown below. If you know that you used virtio in your source VM, and installed the virtio drivers, you can pick that storage controller - otherwise, leave it as AHCI.

1674140629279.png
 

alveolina

Dabbler
Joined
Jan 8, 2023
Messages
11
Thanks or the reply. I've created the ZVOL called "images" and then copied the qcow2 file that sits in a dataset called "vms". If I understand what you are saying, it need to first create the ZVOL, then run qemu-img convert -O raw /mnt/zpool/vms/vm101.qcow2 > /dev/zpool/images.
The output I get is:

admin@zeus[/mnt/zpool/vms]# qemu-img convert -O raw vm-101-disk-0.qcow2 /dev/zpool/images qemu-img: /dev/zpool/images: error while converting raw: Protocol driver 'host_device' does not support image creation, and opening the image failed: Could not open '/dev/zeus2p1/images': Permission denied

Seems like admin user does not have permission to access the ZVOL?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
The thing about ZVOLs is that they aren't where you think you put them...

This is hinted in the posts above, but not made clear enough for you, it seems.

Because ZVOLs are not mounted by the TrueNAS host, they don't appear in the filesystem like they do when you browse your datasets and files.

Instead, they live in a weird structure which looks like:

/dev/zvol/poolname/<dataset if you put it in one>/zvol_is_here

so when you're trying to use /dev/zpool/images, you're inventing a path that doesn't exist, hence nobody having permission to it.

it should be something more like:

qemu-img convert -O raw vm-101-disk-0.qcow2 /dev/zvol/zeus2p1/images

You've mixed up your terminology all over the place, so it's just a guess...

A very strange choice of pool name as it looks a bit like a pool name mixed with a disk/partition identifier, but names are up to you, so whatever.
 
Top