Shared Volumes
The volumes section allows you to define directories to share between the host and the guest.
The volume entries are colon-separated fields, in order:
- The source directory (with
.above, the folder where the virtfile exists) - The mountpoint location inside the guest
- (Optional) Mount options
- (Optional) Virtiofs driver options
Note
If your working directory has colons or commas in its path, you might run into trouble.
Example: Current directory shared and writable by the guest
This will mount the current directory (.) at /shared in the guest. It is writable, meaning changes in the guest also apply to the source filesystem on the host.Example: Current directory mounted read-only
This will enforce the read-only flag in the guest mount options (ro) and in the virtiofs driver (readonly=true). This also happens to be identical to the default shared volume.Default shared volume
If you do not specify any volumes, the default is to mount the current directory read-only at /shared.
Disabling the default
If you prefer not to have the default, you can specify your own volumes (in which case the default will not be included), or you can add the following flag:
Very custom shared volumes
If you need more control over the mount, such as to use protocols other than virtiofs,
consider using the --filesystem option for virt-install.