Skip to main content
Added info from the link so that way one can follow the instruction here although maybe the docs will change over time and/or have additional info/details not shown here.
Source Link
Alexis Wilke
  • 3.1k
  • 2
  • 29
  • 49

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


Edit your domain file with (you may first want to shutdown the domain if it is currently running):

$ virsh edit <domain-name>

And add the following two XML blocks if not there yet:

<domain>
  ...
  <memoryBacking>
    <source type='memfd'/>
    <access mode='shared'/>
  </memoryBacking>
  ...
  <devices>
    ...
    <filesystem type='mount' accessmode='passthrough'>
      <driver type='virtiofs' queue='1024'/>
      <source dir='/path'/>
      <target dir='mount_tag'/>
    </filesystem>
    ...
  </devices>
</domain>

The virtiofs driver will be required, you need to install it with something like:

$ sudo apt-get install virtiofsd

Then restart your domain:

$ virsh start <domain-name>

Once logged in your domain, run the following mount command:

$ mkdir mount_point
$ sudo mount -t virtiofs mount_tag mount_point
$ ls mount_point

The folder is mounted in read/write mode.

The mount_tag name is anything you want. Whatever makes sense to you. The mount_point can be anywhere in your guest file system.

For more features, check out the docs (link above).

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

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


Edit your domain file with (you may first want to shutdown the domain if it is currently running):

$ virsh edit <domain-name>

And add the following two XML blocks if not there yet:

<domain>
  ...
  <memoryBacking>
    <source type='memfd'/>
    <access mode='shared'/>
  </memoryBacking>
  ...
  <devices>
    ...
    <filesystem type='mount' accessmode='passthrough'>
      <driver type='virtiofs' queue='1024'/>
      <source dir='/path'/>
      <target dir='mount_tag'/>
    </filesystem>
    ...
  </devices>
</domain>

The virtiofs driver will be required, you need to install it with something like:

$ sudo apt-get install virtiofsd

Then restart your domain:

$ virsh start <domain-name>

Once logged in your domain, run the following mount command:

$ mkdir mount_point
$ sudo mount -t virtiofs mount_tag mount_point
$ ls mount_point

The folder is mounted in read/write mode.

The mount_tag name is anything you want. Whatever makes sense to you. The mount_point can be anywhere in your guest file system.

For more features, check out the docs (link above).

Source Link
H Han
  • 81
  • 4

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