VirtManager Notes

Create a shared folder between host and guest in Virt manager

  • Skip this step if you already have an existing folder to share.
  • The folder to be shared must exist on the host machine. Lets create it:
sudo mkdir /mnt/sharedsudo chown $USER:$USER /mnt/shared

Enable shared memory for your VM in Virt Manager GUI

Memory > Enable shared memory

Add a filesystem device using VirtManager GUI

Add hardware > Filesystem >

  • Driver: viriofs
  • Source path: /mnt/shared as above. Its the folder on the host that you would like to share
  • Target path: Descriptive name (e.g /hostshare/downloads). This name will be used for mounting the share in the guest vm.

Create an empty folder to hold the share in the guest VM

mkdir -pv ~/shared/Downloadsmkdir -pv ~/shared/Documents
# mount the shared foldersudo mount -t virtiofs hostshare ~/shared
# to add the share to fstab/hostshare/downloads /home/user/shared/Downloads virtiofs defaults 0 0
# Assuming you have a Filesystem object with target path named /hostshare/documents/hostshare/documents /home/user/shared/Documents virtiofs defaults 0 0

For Windows Guests:

When installed for the first time, display resolution is set to 1280x720. To chnage to full screen in HD, make sure the video model is set to QXL in Virt-Manager, and follow below instructions:

Enable Folder Sharing and Display Settings

  1. Open Virt-Manager: Launch Virt-Manager and select your Windows 11 virtual machine.
  2. Edit Virtual Machine Settings:
    • Click on the Info button to view the VM details.
  3. Enable Shared Memory
  4. Add Filesystem Hardware:
    • Click on Add Hardware at the bottom.
    • Select Filesystem from the left panel.
    • In the right panel, set:
      • Driver: virtiofs
      • Source path: Browse to select the directory you created (~/vfs_share).
      • Target path: Enter a name for how it will appear in Windows (e.g., vfs_share).
    • Click on Finish
  5. Run Windows Guest
  6. Install VirtIO Drivers inside the guest for better display handling and also for folder sharing
  7. Download and install the VirtIO drivers inside the Windows guestthe virtio-win.iso
    • Mount the iso file so that you can run some executables from it.
    • Execute the following binaries in order:
      • virtio-win-gt-x64.exe
      • virtio-win-guest-tools.exe
  8. Install WinFsp required for folder sharing
    • Open Windows Services.msc and manually start the VirtIO-FS service.
    • You should see your shared folder listed as a network drive or under "This PC."

Important Notes

  • Virtiofs is generally easier to set up than traditional network-based sharing methods like Samba or NFS
  • Performance may vary depending on your specific use case. For large file transfers between Windows guests and Linux hosts, Samba might offer better performance
  • Ensure that your Linux distribution and kernel version support virtiofs.
  • Always consider security implications when sharing folders between host and guest systems.

By following these steps, you should be able to create a shared folder between your host machine and virtual machine using virt-manager and virtiofs.