How can I copy files between the PVE Host and a VM?
There are many ways,ssh/sshfs
being the recommendation usually. One possible alternative does not need a network: 9p.- this is for temporary usage e.g. maintenance or initial setup. 9p is local, so the VM can not migrate anymore
- for this reason I simply use “root”, which generally is not a good advise for “normal” day-by-day usage
- and: this approach is not supported officially
- on the host exists some folder with data, I chose
/tmp/hoststorage
- it is okay to have data in it, we do not destroy anything
On the host
While the VM is turned off add this single line manually to your/etc/pve/local/qemu-server/<vmid>.conf
file:
Code:
args: -fsdev local,security_model=passthrough,id=fsdev0,path=/tmp/hoststorage -device virtio-9p-pci,id=fs0,fsdev=fsdev0,mount_tag=hostshare
Linux Guest
The guest should start as usual, everything should work normal. Open a root shell and run:
Code:
mkdir /mnt/host
mount -t 9p -o trans=virtio,version=9p2000.L hostshare /mnt/host
Windows Guest
No success for me :-(Seems to be missing: https://github.com/virtio-win/kvm-guest-drivers-windows/issues/126
Is this a valid attempt? https://virtio-fs.gitlab.io/howto-windows.html -- no: “Virtio-fs and virtio-9p are two different two different devices serving the same purpose from user point of view.”
References
man qm.conf
- documents “args: ...”- https://www.linux-kvm.org/page/9p_virtio
- https://wiki.qemu.org/Documentation/9p
Side note: we need a place for FAQs like this, just to find them easier...