In VirtManager, in "show virtual hardware details":
- In "Memory", check "Enable shared memory";
- Press the button "Add hardware";
- In "File system":
- Driver: virtiofs
- if an error blocks the vm boot, use "virtio-9p" here and use
Type=9p
in the filemnt-shared.mount
.
- if an error blocks the vm boot, use "virtio-9p" here and use
- Source path: /shared (this value is the name of the host folder)
- Target path: /shared (this value will be used in the file
mnt-shared.mount
)
- Driver: virtiofs
In the host, create a folder to be shared with all guests:
sudo mkdir /shared
sudo chmod a+w /shared
In each guest, create a folder to be mapped with the host folder:
sudo apt install qemu-guest-agent;
sudo mkdir /mnt/shared
cat <<EOF > /tmp/mnt-shared.mount
[Unit]
Description=Ponto de montagem '/mnt/shared' para VirtManager Guest
[Mount]
What=/shared
Where=/mnt/shared
Type=virtiofs
Options=defaults,rw,noatime
[Install]
WantedBy=multi-user.target
EOF
sudo mv /tmp/mnt-shared.mount /etc/systemd/system/mnt-shared.mount
sudo systemctl enable mnt-shared.mount
sudo systemctl start mnt-shared.mount
# reboot
The end.