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

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

asked Aug 27 by harryxiyou (5,020 points)

1 Answer

 
Best answer

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/

answered Aug 27 by harryxiyou (5,020 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...