2

I am running a VM on a Linux host using qemu+kvm and libvirt, the guest system is CentOS 7. I wish to share a folder between the two such that host:/some/dir becomes accessible as guest:/some/other/dir.

I wish to minimise effort and cannot re-compile the kernel on either side. I experimented with plan9 but cannot get it to run (the p9 dkms module won't compile on the CentOS 7 guest).

There must be a better way? Performance is secondary as it does not work at all right now.

2 Answers 2

1

Just set up sshfs/samba/nfs/etc, it's easier and it just works

EDIT: The point here is, just use a regular file share between the host and the VM, there is absolutely no need to go into dirty untested hacks like plan9.

7
  • I'm not entirely sure it doesn't answer the question, but it should probably be edited to provide a more complete answer. Commented Aug 15, 2016 at 15:58
  • This does provide an answer, the o/p wanted a way to share a directory between the VM and the host. I'm not sure full instructions on how to set up a file share or every sort imaginable will be feasible in this context, the point of the answer is to just say "use a regular file share".
    – dyasny
    Commented Aug 15, 2016 at 16:14
  • Thanks, this could be a solution (but isn't, yet). I already have Samba running but services on the host should not be accessible by the guest. Maybe qemu's built-in Samba server could be an option? I searched but could not find a way to enable it using libvirt/virsh's XML config file.
    – Ned64
    Commented Aug 16, 2016 at 7:19
  • Built in samba server in QEMU? Since when?
    – dyasny
    Commented Aug 16, 2016 at 13:07
  • 1
    Well, this is pretty unusual, I've no idea why they would bloat the code with this nonsense. However, if you want to insert arbitrary qemu commands into the XML, there's a way to do that: libvirt.org/drvqemu.html#qemucommand
    – dyasny
    Commented Aug 16, 2016 at 18:36
0

For Centos 8 or later, you can use virtiofs to realize that: https://libvirt.org/kbase/virtiofs.html

1
  • Thanks, I'll look into that. The guest in question is CentOS 7 but I will revisit this issue when upgrading.
    – Ned64
    Commented Apr 30, 2022 at 12:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .