Return to Level1Techs.com

QEMU / KVM and FreeNAS

So on my desk I have my workstation and my FreeNAS which currently runs one VM.

If I need to run up a lab of VMs I will do it on my workstation using VirtualBox and a spare SSD I have mounted internally.

I was idly thinking how it would be nice to run more VMs on the FreeNAS but I don’t really want to uses its compute and memory to run loads of VMs cause that’s not its job.

So I thought I bet I could source cheap parts on eBay for a Linux hypervisor. As in business where you separate the compute and storage functions into dedicated systems.

The end goal would be to have the Virtual Machine Manager client on my workstation, the QEMU / KVM hypervisor on a separate machine and the VM files stored on the FreeNAS.

I decided try it out on my existing workstation and see what’s what.

After a little faffing I could build a VM via Virtual Machine Manager using QEMU / KVM on my local storage. So now I want to use my already mounted FreeNAS storage.

Some steps are not included below for brevity.

Here is the contents of the mounted drive before we start.

Getting started.

2

Pick an ISO.

3

Manage the storage.

4

Add a storage pool.

5

Add a path.

6

Looking good. A new folder has appeared.

Create a storage volume for the VM.

No errors.

Moving forward.

10

Last step.

11

Nope!

12

The user I am logged in with is a member of the ‘libvirt’ group. Attempting this using the 'Network Exported Directory" option for the storage pool fails with the same issue.

I have successfully gotten VMs working by setting iSCSI targets on the FreeNAS and presenting them to my workstation which you would think would be more complicated (but that seems to come with different issues).

The weird thing is however is that the qcow2 file has been created.

So if I look at the permissions in FreeNAS I see the following.

14

15

If I chmod the qcom2 file to 777 it works but why am I having to do this?

Any advice would be most welcome.

1 Like

Okay, how’d you mount the QEMU share?

What type of share is it?

what are your mount flags?

what are your virt-manager qemu config options?

The share is mounted with this line in fstab

freenas.manymachinesonix.net:/mnt/Pool /mnt/FreeNAS nfs defaults 0 0

Its an NFS share. I guess the flags are 0 0

It is not something I have needed to think about before.

At this point I have not changed any config options in any of the files in /etc/libvirt

My new VM defaults are

screenshot

QEMU emulator version 2.11.1(Debian 1:2.11+dfsg-1ubuntu7.23)

virt-manager 1.5.1

flags, in this case would be “defaults”

okay, good to know.

okay, so it looks like libvirt is setting up improper permissions. It’s a thing that sometimes happens when you use NFS shares. I’d have to fuss around with it a bunch.

Can you show me the file permissions and ownership as it appears on your workstation? (create a new file and try to reproduce the issue if possible)

Apologies for late reply. Work has been busy.

Test file permissions shown from GUI and terminal.

Looking in the logs of the machine being used as the host this error is present.

NFS: v4 server freenas.mydomain.net does not accept raw uid/gids. Reenabling the idmapper.

Lot of posts relating to this error although I am not sure how much I want to change things just out of curiosity.