20.16.2. Filesystems

A filesystems directory on the host physical machine that can be accessed directly from the guest virtual machine virtual machine

 ...
  <devices>
    <filesystem type='template'>
      <source name='my-vm-template'/>
      <target dir='/'/>
    </filesystem>
    <filesystem type='mount' accessmode='passthrough'>
      <driver type='path' wrpolicy='immediate'/>
      <source dir='/export/to/guest'/>
      <target dir='/import/from/host'/>
      <readonly/>
    </filesystem>
    ...
  </devices>
  ...
  

Figure 20.24. Devices - filesystems

The filesystem attribute has the following possible values:
  • type='mount' - Specifies the host physical machine directory to mount in the guest virtual machine. This is the default type if one is not specified. This mode also has an optional sub-element driver, with an attribute type='path' or type='handle'. The driver block has an optional attribute wrpolicy that further controls interaction with the host physical machine page cache; omitting the attribute reverts to the default setting, while specifying a value immediate means that a host physical machine writeback is immediately triggered for all pages touched during a guest virtual machine file write operation
  • type='template' - Specifies the OpenVZ filesystem template and is only used by OpenVZ driver.
  • type='file' - Specifies that a host physical machine file will be treated as an image and mounted in the guest virtual machine. This filesystem format will be autodetected and is only used by LXC driver.
  • type='block' - Specifies the host physical machine block device to mount in the guest virtual machine. The filesystem format will be autodetected and is only used by LXC driver.
  • type='ram' - Specifies that an in-memory filesystem, using memory from the host physical machine OS will be used. The source element has a single attribute usage which gives the memory usage limit in kibibytes and is only used by LXC driver.
  • type='bind' - Specifies a directory inside the guest virtual machine which will be bound to another directory inside the guest virtual machine. This element is only used by LXC driver.
  • accessmode which specifies the security mode for accessing the source. Currently this only works with type='mount' for the QEMU/KVM driver. The possible values are:
    • passthrough - Specifies that the source is accessed with the User's permission settings that are set from inside the guest virtual machine. This is the default access mode if one is not specified.
    • mapped - Specifies that the source is accessed with the permission settings of the hypervisor.
    • squash - Similar to 'passthrough', the exception is that failure of privileged operations like chown are ignored. This makes a passthrough-like mode usable for people who run the hypervisor as non-root.
  • <source> - Specifies that the resource on the host physical machine that is being accessed in the guest virtual machine. The name attribute must be used with <type='template'>, and the dir attribute must be used with <type='mount'>. The usage attribute is used with <type='ram'> to set the memory limit in KB.
  • target - Dictates where the source drivers can be accessed in the guest virtual machine. For most drivers this is an automatic mount point, but for QEMU-KVM this is merely an arbitrary string tag that is exported to the guest virtual machine as a hint for where to mount.
  • readonly - Enables exporting the file sydtem as a readonly mount for guest virtual machine, by default read-write access is given.
  • space_hard_limit - Specifies the maximum space available to this guest virtual machine's filesystem
  • space_soft_limit - Specifies the maximum space available to this guest virtual machine's filesystem. The container is permitted to exceed its soft limits for a grace period of time. Afterwards the hard limit is enforced.