Since I continue to forget how to actually do this I’m making a note
Enabling the filesystem
-
Open Virtual Machine Manager
-
Right click your vm, hit
open
(make sure it’s shutdown) -
Under
Memory
, check theEnable shared memory
box -
Click
Add Hardware
>Filesystem
-
For
Driver
choosevirtiofs
-
For
Source path
put the path to the folder to mount -
For
Target path
put a mount name
Mounting the filesystem
Manually
Once you’ve created the filesystem, now you just need to mount it in the vm.
In your vm, create a directory to mount into:
$ sudo mkdir /mnt/pictures
Then mount the filesystem:
$ sudo mount -t virtiofs <your-target-path-value> /mnt/pictures
Where <your-target-path-value>
is the value you put for Target path
in step 7 above.
Using fstab
You probably want to auto mount the filesystem when the vm starts. This can be done using Fstab.
Open /etc/fstab
with your editor of choice.
$ sudo vim /etc/fstab
Add a new line and use the following format:
<your-target-path-value> /mnt/location virtiofs defaults 0 0
Where <your-target-path-value>
is the value you put for Target path
in step 7 above.
You might need to reload systemd:
$ sudo systemctl daemon-reload
Then you can mount simply using:
$ sudo mount /mnt/location
Where /mnt/location
is the path you put in Fstab