Skip to content

Latest commit

 

History

History
143 lines (99 loc) · 1.97 KB

VirtManager-Share.md

File metadata and controls

143 lines (99 loc) · 1.97 KB

Virt Manager - Share with Linux Guest

ClipBoard, Drag and Drop - مشاركة النصوص

  • Debian - Ubuntu
sudo apt install spice-vdagent
  • Fedora
sudo dnf install spice-vdagent
  • Arch
sudo pacman -S spice-vdagent
  • NixOS

add the below line to configuration.nix

services.spice-vdagentd.enable = true;

Shared Folder - مشاركة الملفات

Requirements

  • qemu-kvm version 5.0 at least
qemu-kvm -version

On Host

  • creat the folder you want to share

  • Open VM settings > Memory and enable shared memory or add:

<memoryBacking>
  <source type="memfd"/>
  <access mode="shared"/>
</memoryBacking>
  • Add Hardware and chose Filesystem:

    • Driver virtiofs
    • Source path /shared/folder/on/host
    • Target path shared-folder-name-on-guest

Or add

<filesystem type="mount" accessmode="passthrough">
  <driver type="virtiofs"/>
  <source dir="/shared/folder/on/host"/>
  <target dir="shared-folder-name-on-guest"/>
  <address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</filesystem>
  • Start your VM

On Guest

  • Creat a folder to mount the share
mkdir host-share
  • Run:
sudo mount -t virtiofs shared-folder-name-on-guest /path/to/mount/on/guest
  • auto mount
sudo nano /etc/fstab

append

shared-folder-name-on-guest  /path/to/mount/on/guest  virtiofs  defaults  0  0

or

echo "shared-folder-name-on-guest  /path/to/mount/on/guest  virtiofs  defaults  0  0" | sudo tee -a /etc/fstab
  • Mount
sudo mount -a

or

sudo reboot now

NixOS Guest

sudo nano /etc/nixos/configuration.nix
  systemd.mounts = [
    {
      what = "shared-folder-name-on-guest";
      where = "/path/to/mount/on/guest";
      type = "virtiofs";
      wantedBy = [ "multi-user.target" ];
      enable = true;
    }
  ];
sudo nixos-rebuild switch
sudo reboot now