Benutzer-Werkzeuge

Webseiten-Werkzeuge


it-wiki:proxmox:kvm_shared_folder

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

it-wiki:proxmox:kvm_shared_folder [2023/07/20 17:43] – angelegt markoit-wiki:proxmox:kvm_shared_folder [2023/07/20 18:00] (aktuell) marko
Zeile 1: Zeile 1:
 ====== Share Folder Between Guest and Host in virt-manager (KVM/Qemu/libvirt) ====== ====== Share Folder Between Guest and Host in virt-manager (KVM/Qemu/libvirt) ======
 ** In this guide, you will learn how to share a folder between host and guest in virt-manager using KVM, QEMU and libvirt. ** ** In this guide, you will learn how to share a folder between host and guest in virt-manager using KVM, QEMU and libvirt. **
 +
 The [[https://virt-manager.org/|virt-manager]] application or package uses the [[https://libvirt.org/manpages/libvirtd.html|libvirt]] library to provide virtual machine management services. It has a desktop interface that helps to create, delete, and manage multiple virtual machines. The [[https://virt-manager.org/|virt-manager]] application or package uses the [[https://libvirt.org/manpages/libvirtd.html|libvirt]] library to provide virtual machine management services. It has a desktop interface that helps to create, delete, and manage multiple virtual machines.
  
Zeile 6: Zeile 7:
  
 ===== A note about virtiofs ===== ===== A note about virtiofs =====
 +The sharing files and folders are powered by the libvirt shared file system called virtiofs. It provides all the features and parameters to access the directory tree on the host machine. Since most of the virt-manager virtual machine configurations are translated to XML, the share files/folders can also be specified by the XML file.
 +
 +===== Share folder in virt-manager =====
 +  * ListenpunktFirst, make sure your guest virtual machine is powered off. From the virt-manager GUI, select the virtual machine and click on Open to pull up the console settings.
 +
 +{{ :it-wiki:proxmox:open-the-settings.jpg?nolink |}}
 +
 +  * Click on the icon which says show virtual hardware details in the toolbar. And then click on Memory on the left panel.
 +  * Select the option “Enable shared memory“. Click Apply.
 +
 +{{ :it-wiki:proxmox:enable-the-shared-memory-option.jpg?nolink |}}
 +
 +  * And then click “Add hardware” at the bottom.
 +
 +{{ :it-wiki:proxmox:click-on-add-hardware.jpg?nolink |}}
 +
 +  * Select **File system** from the left panel in the add new hardware window.
 +  * Then select **Driver=virtiofs** in the details tab. Click on ''browse > browse local'' and **select the host path** you want to access inside the guest VM.
 +  * In the target path, mention any name you want. It’s just a file tag which will be used during mount.
 +  * So, if I want to access the Pictures/Screenshots folder (''/home/debugpoint/Pictures/Screenshots''), sample settings could be the following:
 +
 +{{ :it-wiki:proxmox:add-a-new-file-system-hardware.jpg?nolink |}}
 +
 +The XML settings are below for the above configuration. You can find it in the XML tab.
 +<code xml>
 +<filesystem type="mount" accessmode="passthrough">
 +  <driver type="virtiofs"/>
 +  <binary path="/usr/libexec/virtiofsd"/>
 +  <source dir="/home/debugpoint/Pictures/Screenshots"/>
 +  <target dir="mount_tag_pictures"/>
 +  <alias name="fs1"/>
 +  <address type="pci" domain="0x0000" bus="0x08" slot="0x00" function="0x0"/>
 +</filesystem>
 +</code>
 +
 +Click on Finish. In the main virt-manager window, right-click on the VM and click Run to start the virtual machine. Make sure to click on the “show the graphical console” (monitor icon in the toolbar – if the VM is not showing.
 +
 +In the guest machine, create a folder where you want to mount the host folder. For this example, I have used /mnt/pictures.
 +<code bash>
 +sudo mkdir /mnt/pictures
 +</code>
 +
 +And finally, mount the host folder using the tag you created in the above step to this new folder. Use the following command to do that from the terminal. Ensure to change the tag and folder name in the below command as your system.
 +<code bash>
 +sudo mount -t virtiofs mount_tag_pictures /mnt/pictures
 +</code>
 +
 +Now you can browse the folders and add/delete items seamlessly in virt-manager between host and guest.
it-wiki/proxmox/kvm_shared_folder.1689875020.txt.gz · Zuletzt geändert: 2023/07/20 17:43 von marko