Setup libvirt.

Libvirt ZFS Dataset

To keep my libvirt setup outside of any boot environments I give them their own dataset.

Add to fstab


Check modules are loaded.

If blank, load them explicitly.

Install the dependencies.

ZVOL Backing Store

I like to use ZFS ZVOL's as my backing store.


Create a dataset for ZVOLs:

User ZVOLs

Create a dataset for user 'john''s ZVOLs

As of zfsonlinux 0.7.0 ZFS delegation using zfs allow works on linux. Delegate permissions giving the abiity to snapshot and create datasets.

Create ZVOL

To let guest do its own caching, use:

  • primarycache=metadata

Create ZVOL for a new VM. Replace with name. Volumes still need to be created by root.


By default, anybody in the wheel group can authenticate with polkit as defined in /etc/polkit-1/rules.d/50-default.rules (see Polkit#Administrator identities).

If you want passwordless authentication, as of libvirt 1.2.16, anyone in the libvirt group can access to the RW daemon socket by default.

Create the group if it doesn't exist.

Add any users required to it.

Make sure to re-login after.

System Service

Enable libvirtd.service.

To run only a user-session the daemon does not need to be enabled.


Test libvirt system-session:

Test libvirt system user-session:


Add the following to /etc/libvirt/qemu.conf.

I have found UEFI may not work if I haven't set the system user to user = root in /etc/libvirt/qemu.conf.

and restart libvirtd


To use uefi as a user, note networking options are limited, move the nvram to a user readable location and add it to ~/.config/libvirt/qemu.conf.

Add the following to /etc/libvirt/qemu.conf.

Create Guest

Use virsh or virt manager.


Select virtIO Network and storage for best performance. Select ZVOL raw device. Mine was /dev/vault/zvols/john/libvirt/<new VM>.

ZVOL Persistance

If using a user session the block device might need to be changed to be owned by the user running the VM.

Temporarily the device can be chown'd, but the owner will not live through reboot. For persistence add a udev rule by creating a new file 99-local-zvol.rules in /etc/udev/rules.d/ that contains the following (replacing the ZVOL path and user):

Refresh the rules with udevadm control --reload


Install drivers:

I downloaded ISO and attached the drivers pre-install.

At the "Where do you want to install Windows?" screen, select the option Load Drivers, uncheck the box for "Hide drivers that aren't compatible with this computer's hardware".

Browse to the wanted driver(s) at:

SCSI: "viostor\w10\amd64" Networking: "NetKVM\w10\amd64"


To use another interface, don't configure anything on the host and select macvtap passthrough, and select the interface.

Install then reboot.

Last updated