[daily][qemu][kvm] Use virtfs to share directories between host and guest

 

As the title.

I used NFS before, and NFS would have synchronization problems. For example, the time synchronization problem when compiling files, see the previous article.

 

Today, we use advanced virtfs:

See: https://www.linux-kvm.org/page/9p_virtio

 

One: The settings on the host, using parameters similar to the following:

 13         -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=Tsrc \              
 14         -fsdev local,security_model=passthrough,id=fsdev0,path=/root/Src \          

 

Two: In the guest settings, mount:

Probably so,

# mkdir /tmp/host_files
# mount -t 9p -o trans=virtio,version=9p2000.L hostshare /tmp/host_files

 

CentOS7 doesn't support it yet, so I didn't try it out either.

[root@D129 ~]# cat /boot/config-3.10.0-327.el7.x86_64  |grep -i 9p
# CONFIG_NET_9P is not set
[root@D129 ~]# 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324507853&siteId=291194637