The Problem
When QEMU/KVM runs, it runs as a special user called libvert
. This user must be able to read and write to the external drive, in particular, the partition formatted ExFat
inside the external drive.
When an user, let's say adam
is logged on and connects an USB drive to the Ubuntu computer, Ubuntu mounts the partition(s) in that USB drive so that only the user, adam
in this example, can write to that partition. When libvert
or any other user tries to write, or modify a file in that partition it fails.
The Solution
I have tried this solution on a 32GB USB flash drive formatted ExFat. I was able to install Ubuntu 22.04 Minimal installation, and run the VM from the USB drive. However, this is a very unusual setup and may break under heavy testing.
1. Find the UUID of the partition of the external drive
Open the app Disks and click on the external drive on the left panel. Then click on the main partition on the main window. You will see something like the screenshot below. Note down the UUID of the partition. In this case, the UUID is 6431-BACB
.

2. Create a new mount-point
Make sure the external drive is not plugged in. If plugged in, unmount the drive (partition) and unplug it when it is safe to do so.
Open a terminal and enter the following two commands:
sudo mkdir -p /media/alexander/VM
sudo chmod 0777 /media/alexander/VM
Change alexander
with your username.
The first command creates the folder VM
inside /media/alexander/
. The second command allows other users to read and write inside this folder. You have to use these commands only once.
Note, usually the folder /alexander/VM
is dynamically created when this USB drive is plugged in. Since we will stop this automatic mounting process, we need to create this folder manually. If you want this USB drive to be mounted as "root" you may want to create a different mount-point such as /media/VM
or /mnt/VM
.
3. Edit /etc/fstab
Open the file /etc/fstab
using the command:
sudo gedit /etc/fstab
Go to the bottom of the file and add these lines:
# The next line is for the external VM Drive
UUID=6431-BACB /media/32GBExFat exfat user,uid=1000,umask=000,utf8,noauto,nofail 0 0
Make sure the UUID is the correct one for the partition in the external drive that is to contain the VM related files.
I have assumed that you are the first and only user of this computer. If your UID is not 1000, you will have to change it in the above command. The partition will be mounted with your credentials.If you want the partition to be mounted as "root", remove the option uid=1000
from the above line.
Save the file and exit the editor.
Warning: The ExFat partition of this disk will not be automatically mounted when an user plugs in this drive after this step. You will have to manually mount the drive using one of the methods described in the next step.
4. Test and Build VMs
Plugin the external drive. It should not be auto-mounted. Mount the partition by any one of the following methods:
- Click on the icon that appeared on the Dock.
- Click on the "VM" item on the left panel of Files (AKA Nautilus).
- On the terminal type
sudo mount /dev/sda2
Once the partition is mounted, open the folder "VM" and right click on any blank space. Then select Properties from the context menu. Go to the Permissions tab and verify "Others" can "Create and Delete Files".
Now you should be able to continue creating VM storage files in the external drive.
Note: It is a good idea to create a folder inside the "VM" partition. You may call it "VM_Storage" or something. Keep your ISO and qcow files in this folder rather than in the "root" of the partition.
For ext4
, try VMM as root
first, make sure all the files and folders in this partition can be written to by any users. This can be done in Nautilus of using the command:
sudo chmod 0777 -R /media/alexander/VM
Try starting the Virtual Machine Manager with sudo before you build a new virtual machine. Open VMM as root using this command in the terminal:
sudo virt-manager
See Virt-Manager error to create an images qcow2 on an external HDD for more details.
Hope this helps