简体   繁体   English

有没有办法与来宾(centos 7)共享主机(ubuntu)文件系统?

[英]Is there a way to share host (ubuntu) file system with guest (centos 7)?

I am trying to use virsh and domain xml to launch a Centos 7 guest from ubuntu 16.04 LTS host. 我正在尝试使用virsh和domain xml从ubuntu 16.04 LTS主机启动Centos 7来宾。 The "filesystem" node that i am using in domain xml is as below: 我在域xml中使用的“文件系统”节点如下:

    <filesystem type='mount' accessmode='passthrough'>
        <driver type='path' wrpolicy='immediate'/>
         <source dir='/opt/test'/>
         <target dir='testlabel'/>
    </filesystem>

With the above config, "testlabel" is not visible in the guest and hence i am not able to mount it. 使用上述配置,“ testlabel”在客户机中不可见,因此我无法安装它。 Is there anything that i am missing? 有什么我想念的吗?

I tried to have 9p modules in guest but they don't seem to be available in centos 7. 我尝试在guest虚拟机中使用9p模块,但在centos 7中似乎不可用。

I do not want to use network based file sharing like NFS or glusterfs either. 我也不想使用基于网络的文件共享,例如NFS或glusterfs。

RHEL-7 (and thus CentOS-7) explicitly does not support the 9p filesystem. RHEL-7(因此是CentOS-7)明确不支持9p文件系统。 It is disabled in guest kernel builds and also disabled in QEMU builds for RHEL hosts. 在来宾内核构建中已禁用该功能,在RHEL主机的QEMU构建中也已禁用了此功能。 The reason is that 9p support in QEMU has been largely unmaintained upstream and the QEMU community doesn't have confidence its is security or performance. 原因是QEMU中的9p支持在上游基本上没有得到维护,QEMU社区对它的安全性或性能没有信心。

If you want to share filesystem locations, pretty much your only choice is to use a traditional network filesystem, whether NFS, SAMBA, or something tunnelled like SSHFS. 如果要共享文件系统位置,则几乎唯一的选择是使用传统的网络文件系统,无论是NFS,SAMBA还是类似SSHFS的隧道化文件。

Work is ongoing upstream to support a new technology called virtio-vsock, which will allow running NFS-over-vsock, bypassing the need for networking - think of it as akin to NFS over UNIX sockets. 上游工作正在进行中,以支持称为virtio-vsock的新技术,该技术将允许通过vsock运行NFS,而无需网络连接-将其视为类似于UNIX套接字上的NFS。 This is not ready for use yet though, so not possible for an Ubuntu/RHEL-7 pair. 但是,此功能尚未准备就绪,因此无法用于Ubuntu / RHEL-7对。

Use for the guest (CentOS 7) the kernel from the CentOSPlus repository Wiki CentOSPlus . 为来宾(CentOS 7)使用来自CentOSPlus存储库Wiki CentOSPlus的内核。 The CentOSPlus kernel has the 9p file system support build in. You can install the "kernel-plus" kernel with CentOSPlus内核内置了9​​p文件系统支持。您可以使用以下命令安装“ kernel-plus”内核:

yum --enablerepo=centosplus install kernel-plus

Start the guest with the "kernel-plus" kernel and 使用“ kernel-plus”内核启动客户机,然后

mount -t 9p -o trans=virtio {sharetarget} {mountpoint}

works. 作品。 I use it this way on CentOS 7 guest systems. 我在CentOS 7来宾系统上以这种方式使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ssh:尝试从主机(centOS 6.5)到来宾服务器的SSH时,连接被拒绝(在oracle虚拟机上,ubuntu 15) - ssh: Connection refused while trying ssh from host (centOS 6.5) to guest server (on oracle virtual box, ubuntu 15) 从主机(Windows)访问来宾(Ubuntu)本地主机 - Accessing guest (Ubuntu) localhost from host (Windows) 如何在虚拟机中的主客户文件系统上使用Git worktree - How to use Git worktree on host-guest file system in virtual machine 使用KVM将文件夹从主机共享到来宾VM - Share folder from Host to Guest VM using KVM Selenium Grid Ubuntu主机无法在Windows Guest虚拟机中创建节点 - Selenium grid ubuntu host can't create node in Windows guest 什么是CentOS和Ubuntu上的“常规文件”? - What is “the regular file” on CentOS and Ubuntu? 无法在VirtualBox for CentOS 6 guest中安装Guest Additions - Can not install Guest Additions in VirtualBox for CentOS 6 guest 如何访问 virtualbox 中的共享文件夹。 主机 Win7,来宾 Fedora 16? - How to access share folder in virtualbox. Host Win7, Guest Fedora 16? 检查安装了哪个操作系统(CentOS、Ubuntu、Redhat 等) - Check Which operating system is installed ( CentOS, Ubuntu, Redhat, ... etc) 使用 VirtualBox 从来宾访问主机上的站点? 主机和来宾是 linux - Use VirtualBox to access site on host from guest? the host and guest is linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM