Because kvm builds on top of QEMU, it's just a hw acceleration.
With this you can see that the actual process running your VM is a kvm process.
ps xa| grep "[b]in/kvm"
I had this permissions issue when running VM's from a thumb drive.
The problem I was having was that my system (Fedora 27) automatically mounts new drives (external HDDs, USB, SD) to
/run/media/(username)/(device name)
(on your system it's /media/username/....)
For whatever reason this causes the permissions issue. By default it was mounted with fmask=0022
and dmask=0022
(use man mount
for details). To fix the issue we need to unmount the drive from that location as root, and then mount it to /mnt
. In the example below the thumb drive is /dev/sdc1
. We need to remount it with fmask=0011
to allow write access for all users and groups.
# su - (then enter root password)
# umount /run/media/yourusername/devicename
# mount /dev/sdc1 /mnt -o fmask=0011 (mount usb to /mnt)
After that I just made sure to have symbolic links from the original location of the qcow2 drives to the new location (still as root)
# cd /var/lib/libvirt/images
# ln -s (new target) (link name)
so if your VM is named MyVM
# ln -s /mnt/Myvm.qcow2 MyVm.qcow2
Once I saw that my VMs were now working, I edited /etc/fstab
to automatically mount the drive at /mnt
. The folders and qcow2 drives were owned by my standard user account and group. I am sure there are better ways to do it, but this is what worked for me.
Best Answer
On Debian based distro you should use
virt-resize
instead. This handle pretty much everything under the hood now. Let's assume your image is called Win7 (why not?). First thing make sure your VM is shut down:Install the tool:
Get the location of your VM disk:
You may need to adapt
/var/lib/libvirt/images/Win7.img
in the following:Create your 64G disk:
You'll need to expand /dev/sda2 (not the boot partition):
Make a backup just in case (or use
mv
if you do not want the backup):Now boot !
For more info: man virt-resize