0

I have Ubuntu 20.04. as host, with 5 virtual machines:

  • Ubuntu 20.04.
  • Ubuntu 22.04.
  • Ubuntu 24.04.
  • Fedora 39
  • Fedora 40

In each I have set:

<filesystem type="mount" accessmode="passthrough">
  <driver type="path" wrpolicy="immediate"/>
  <source dir="/mnt/sda1/VM_data"/>
  <target dir="VM_data"/>
  <address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
</filesystem>

In each VM, I did set:

    /VM_data   /home/<user>/host_data   9p  trans=virtio,rw,_netdev 0   0

to /etc/fstab

All VMs correctly show directory in specified path, except Ubuntu 24.04. For some reason I can't make it work in Ubuntu 24.04. I see just empty directory in VM, and whatever I write to the folder doesn't appear in host and vice versa. The directory doesn't seem to be "shared".

Can someone help me how to make the directory appear in my VM with data in host and make "sharing" work properly?

Mlocik97
  • 459

1 Answers1

4

I have a similar setup with an Ubuntu 24.04 guest. However I share my "Public" folder of the host computer with the Ubuntu 24.04 guest.

My VMM Setup looks like: VMM File System Settings

The XML code of the corresponding page is:

<filesystem type="mount" accessmode="mapped">
  <source dir="/home/xxxxxxxx/Public"/>
  <target dir="public"/>
  <alias name="fs0"/>
  <address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
</filesystem>

The corresponding line in /etc/fstab of the guest Ubuntu 24.04 is:

public /home/xxxxxxxx/Public 9p trans=virtio,version=9p2000.L,rw 0 0

From: https://wiki.qemu.org/Documentation/9p

There are currently 3 dialects of the 9p network protocol called "9p2000", "9p2000.u" and "9p2000.L". Note that QEMU's 9pfs implementation only supports either "9p2000.u" or "9p2000.L".

9p2000

This is the basis of the 9p protocol the other two dialects derive from. This is the specification of the protocol: 9p2000 Protocol

9p2000.u

The "9p2000.u" dialect adds extensions and minor adjustments to the protocol for Unix systems, especially for common data types available on a Unix system. For instance the basic "9p2000" protocol version only returns an error text if some error occurred on server side, whereas "9p2000.u" also returns an appropriate, common POSIX error code for the individual error. 9p2000.u Protocol

9p2000.L

Similar to the "9p2000.u" dialect, the "9p2000.L" dialect adds extensions and minor adjustments of the protocol specifically for Linux systems. Again this is mostly targeted at specializing for data types of system calls available on a Linux system. 9p2000.L Protocol

This setup works for me.

Hope this helps

kos
  • 41,268
user68186
  • 37,461