:bulb: How to create a shared folder between a VM and the Host.

[01] Environment

  • Ubuntu 24.04
  • virt-manager, KVM, QEMU, virsh, libvirt

[02] Host-Side Setup

1
2
3
4
5
# Create the directory
sudo mkdir vm-shared

# Set permissions (read/write for all users)
sudo chmod 777 vm-shared

[03] virt-manager Setup

3-1. Open Virtual Machine Details

  • virt-manager menu → Edit → Virtual Machine Details
  • VM window menu → View → Details

3-2. Enable Shared Memory

  • Memory → Details → check Enable shared memory

3-3. Add Filesystem

  • Bottom Add Hardware → Filesystem → Details → fill Source path / Target path
    • Source path: Host directory to expose as the shared folder (use Browse → Local Directory)
    • Target path: name to use when mounting the shared folder inside the VM
  • Apply

[04] VM-Side Setup

4-1. Create Shared Folder

1
2
3
4
5
# Create the directory
sudo mkdir vm-shared

# Set permissions (read/write for all users)
sudo chmod 777 vm-shared

4-2. Mount

1
2
# mount -t type target_path vm_shared_folder_path
sudo mount -t virtiofs vm-shared /root/vm-shared