Following my research on Plan 9 file sharing in qemu a week or so ago, I will now briefly provide you with a little bit qemu file sharing between host and guest 'magic'. I was so excited when I first found this and it proved to work (took me a while to piece it altogether and make it work the first time though).
DISCLAIMER: Obviously the following very powerful file sharing technology can be very dangerous depending what folders you share, but then again running as root user is dangerous in that sense anyway. Handle with care and at your own risk.
Once again, for convenience cutting and pasting below commands, it is handy to start a browser in your VM once it is booted so you can read this post and cut and post from it into your guest VM.
- Prior to starting your virtual machine load the module 9p and dependencies on your host machine using terminal command:
Code: Select all
modprobe 9p
- Let's say for argument you are about to boot a cdrom in qemu by going to the directory the cdrom is in. At the end of the qemu command you use, put a space followed by a \ and that lets you add another line of options. Add the following:
Code: Select all
-fsdev local,security_model=mapped,id=fsdev-fs0,multidevs=remap,path=. -device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs0
Note the path=. above. That 'dot' after the equals sign means you are going to share the 'current directory' between the host and the guest VM. But understand that you can use any path=<PATH> in practice I think.
- Once VM is booted. In that guest open a terminal and create a mount point for the shared directory as follows:
Code: Select all
mkdir /mnt/inst # you could really call the mount point directory anything
- Finally, you should be able to mount the shared directory in your guest VM using guest command:
Code: Select all
mount -t 9p -o trans=virtio fs0 /mnt/inst -oversion=9p2000.L,posixacl,msize=5000000,cache=mmap
In your guest VM you should now be able to view the host files inside (from where you started) inside that directory /mnt/inst
Furthermore you can use the files from there and also put new files in there if you want which will immediately also be on the host computer. i.e. You can share in both directions. So put away your ftp server clumsy techniques, and so on, this method may (at times) prove better for you.
NOTE: I don't know how 'secure' this Plan 9 file sharing method is when running qemu as root user. The method does however also work if you start your virtual machine as a normal user (though you'd have to be root user in the virtual machine guest to do the command needed there (one way being to first run the command "sudo bash" inside the virtual machine guest, assuming you weren't already root user and sudo is available for whoever you are there...). Apparently the methodology is pretty secure in that situation, but who cares if it works anyway eh? NOTE2: I haven't actually tried it yet with KLV as the host; I've only tried it with Zorin lite OS host and KLV VM guest, but I hope it will work fine with KLV host too.
EDIT: Okay, just confirmed that above also worked using KLV host with KLV guest.
EDIT (22July2024): Also for EasyOS here by @Frederico 01July2023 here:
Finishing Touched -> Sharing a folder with the host (requires EasyOS >= 5.4.3): viewtopic.php?p=92950#p92950