0

I'm new to KVM and trying to get ahead. I have a Win10 system in QEMU. Now I have a few questions:

  1. I know that QEMU stores the image files as .qcow2 under the directory "/var/lib/libvirt/images/". Is it possible to enter these image files? For example, I want to enter the Win10 file system and add a file to the C:// directory.

  2. Are there ways to manage only KVM without using QEMU?

  3. How can I manage KVM with Python? (I want to add the file I mentioned above with python.)

  • The userspace component of KVM is qemu. You can access disk image files with a variety of technologies. If you mean that you want to add a file to the filesystem without running a virtual machine, you would need to attach the disk image to your system, mount the filesystem, and add the files. If the disk image is a raw disk, then you can use a loopback device on a linux host. If it is not a raw image, you could use qemu-nbd with the linux nbd (network block device) functionality to access it as a block device. – programmerq Aug 02 '21 at 13:29
  • thanks for the answer. I was able to access the filesystem as you mentioned with qemu-nbd. So, is there a direct access method with python without doing mount operations? – virtualman13 Aug 03 '21 at 14:26
  • It is feasible that python could interact with a disk image in whatever format your disk image is in, but I am not aware of a python-native filesystem implementation that would be able to write out a file on a windows NTFS filesystem. All the filesystem implementations that I am aware of require mounting to do writes to that filesystem. You could have python do the calls to set up the block device, do the mount, write the file, unmount, and spin down the nbd stuff. – programmerq Aug 03 '21 at 15:04

0 Answers0