For QEMU/KVM, how to share data between host and guest

General question for developers to access data between VM and VMM.

As I know, paravirtualization solution is a good way to share data for VM and VMM since it has better performance.

Please use Virtio 9p solution for QEMU/KVM. Note that you need to load 9p related modules for guest kernel.

Add following in your virsh start xml file.

<filesystem type='mount' accessmode='passthrough'>
  <source dir='host_dir_path'/>
  <target dir='testlabel'/>
</filesystem>

After start guest OS, run following command

# mount testlabel /mnt/ -t 9p -o trans=virtio

References
[1] http://wiki.qemu.org/Documentation/9psetup
[2] https://www.linux-kvm.org/page/9p_virtio
[3] http://rabexc.org/posts/p9-setup-in-libvirt
[4] https://dustymabe.com/2012/09/11/share-a-folder-between-kvm-host-and-guest/



Leave a Reply

Your email address will not be published. Required fields are marked *