Data exchange between Linux guest and Linux host with Qemu.
Exchanging data between the host and guest system under Linux is relatively simple. Let’s go!
Video
Installation on the host system
We install the following package on the host, if not already installed:
sudo apt install virtiofsd
Add file system in the guest
In Virt-Manager we can edit the virtual machine and add a new hardware.
Here we add a file system/file system. As the source, we enter the folder that we want to make available in the virtual machine. As the target path, we enter a name that we need immediately for the assignment. The name can be freely chosen here.
If the following error message appears:
Unable to add device: unsupported configuration: ‘virtiofs’ requires shared memory
Then we need to enable shared memory.
Use sharing in the guest system
First, we create a folder in which we want to integrate our share.
sudo mkdir /mnt/shared
We can then integrate the release:
sudo mount -t virtiofs shared /mnt/shared
“shared” is the name we assigned above.
Include automatically at system startup
The share is now included, but the next time the system is started, the input is gone again. By editing the file “/etc/fstab
“, we can automatically include the share at startup.
shared /mnt/shared virtiofs defaults 0 0
Conclusion
The share is now also available when the guest system is started. Basically everything is quite simple and problem-free.