Sharing a folder in virt-manager was a something. This is for Linux on Linux only. Didn’t use a virtual manager for a while now, but I have notes how to do it. I think there are two ways, one with virtiofs and the other way with virtio-9p if the guest doesn’t support virtiofs? I honestly forgot the details, so you might need to research a bit again. I’m relatively new to Virt-Manager and Qemu+Kvm, and don’t understand every detail. It was a challenge to figure out all of this. My notes:
Host
First create a directory on your host system (the real machine outside of virtual machine). This folder will be shared:
Then go and start the guest virtual machine. In the guest execute following commands, depending on which previous settings you have. Just create a folder in the virtual machine and mount it with virtiofs. Here this means “share” is the target (we set previously under - Target: /share) and “home/tuncay/Public” is the folder you want to use IN THE guest. The “share” name will then be connected to Virt-Manager, which in previous settings resolves to - Source: /home/tuncay/Public/vm_share on your real machine.
virtiofs:
Either mount the drive every time you start the guest, or you can just mount it in /etc/fstab automatically, like in bottom example.
Guest:
mkdir /home/tuncay/Public/
sudo mount -t virtiofs share /home/tuncay/Public
... or Guest /etc/fstab:
share /home/tuncay/Public virtiofs defaults 0 0
or use virtio-9p, but this one does not work with fstab and the command is slightly more complicated. You can write a script and save it in the guest. Either autorun the script or just when you need it by demand.
virtio-9p:
Guest:
mkdir /home/tuncay/Public/
sudo mount -t 9p -otrans=virtio,rw,version=9p2000.L /share /home/tuncay/Public
Sharing a folder in virt-manager was a something. This is for Linux on Linux only. Didn’t use a virtual manager for a while now, but I have notes how to do it. I think there are two ways, one with virtiofs and the other way with virtio-9p if the guest doesn’t support virtiofs? I honestly forgot the details, so you might need to research a bit again. I’m relatively new to Virt-Manager and Qemu+Kvm, and don’t understand every detail. It was a challenge to figure out all of this. My notes:
Host
First create a directory on your host system (the real machine outside of virtual machine). This folder will be shared:
mkdir /home/tuncay/Public/vm_share/ chmod 777 /home/tuncay/Public/vm_share/
In the Virt-Manager for your Linux guest, set following settings first.
either
virtiofs:
Virt-Manager: Add Hardware > Filesystem - Driver: virtiofs - Source: /home/tuncay/Public/vm_share - Target: share
or
virtio-9p:
Virt-Manager: Add Hardware > Filesystem - Driver: virtio-9p - Source: /home/tuncay/Public/vm_share - Target: /share
Then go and start the guest virtual machine. In the guest execute following commands, depending on which previous settings you have. Just create a folder in the virtual machine and mount it with virtiofs. Here this means “share” is the target (we set previously under
- Target: /share
) and “home/tuncay/Public” is the folder you want to use IN THE guest. The “share” name will then be connected to Virt-Manager, which in previous settings resolves to- Source: /home/tuncay/Public/vm_share
on your real machine.virtiofs:
Either mount the drive every time you start the guest, or you can just mount it in /etc/fstab automatically, like in bottom example.
Guest: mkdir /home/tuncay/Public/ sudo mount -t virtiofs share /home/tuncay/Public ... or Guest /etc/fstab: share /home/tuncay/Public virtiofs defaults 0 0
or use virtio-9p, but this one does not work with fstab and the command is slightly more complicated. You can write a script and save it in the guest. Either autorun the script or just when you need it by demand.
virtio-9p:
Guest: mkdir /home/tuncay/Public/ sudo mount -t 9p -otrans=virtio,rw,version=9p2000.L /share /home/tuncay/Public