gns3-server
gns3-server copied to clipboard
File transfer to QEMU
For Docker, we can use the command "docker cp" to transfer files to a container. But for QEMU, how do we do it without using the cloud?
I tried using a shared folder (mount -t 9p…), but it's not the best way because I need to execute the command to mount the shared folder in the QEMU system every time it starts. Furthermore, mounting a shared folder doesn't seem to work with Windows systems.
Do you have a good way to transfer files without using the cloud?
Do you have a good way to transfer files without using the cloud?
Have you found a way to do it?
Do you have a good way to transfer files without using the cloud?
Have you found a way to do it?
First, please forgive me if there are some mistakes in my grammar
I found a way to make it work. Still mount external folder.
For Linux Qemu
You can mount a shared folder like following content. Add the command when the Qemu starts:
qemu-system-x86_64 … -virtfs local,path=/mnt/shared,mount_tag=host0,security_model=passthrough,id=host0
And then, you should create a new folder in the system:
mkdir -p /mnt/shared mount -t 9p -o trans=virtio,version=9p2000.L host0 /mnt/shared
For Windows Qemu
I tried to using Samba, it works.
You can refer this link, it's from Qemu official: https://www.qemu.org/docs/master/system/invocation.html#hxtool-5
First, you should install the Samba server in your host system.
And then, add the command when the Qemu starts:
-nic user,id=nic0,smb=/share_directory
There is a example
qemu-system-x86_64 -name win7-Lite-1 -m 2048M -smp cpus=1,sockets=1 -enable-kvm -machine smm=off -boot order=c -drive file=/data/gns3/data/GNS3/images/QEMU/win7-Lite.qcow2 -vnc 0.0.0.0:2 -nic user,id=nic0,smb=/opt -machine usb=on -device usb-tablet
When you start your Windows Qemu system, you should check your ip address.
And then, adding a Network mapping.
Samba uses the x.x.x.4 address by default, the qemu official document also mention it.
If it succeeds, a new hard drive will appear.
A different approach could leverage the USB redirection feature supported by virt-viewer in order to alternatively attach/detach a pseudo USB removable disk to a virtual appliance.
Actually, I found a new way to transfer files, set the IP address in real-time address, etc.
If your Qemu file can be pre-installed software, you can install the Qemu-Guest-Agent(QGA). I experimented with it on Windows 7-10, Centos 6-8, and Ubuntu 18-24. They all work.
For different platforms, QGA will have some version differences, but the basic features will work.
related reference:https://www.qemu.org/docs/master/interop/qemu-ga.html
spice-webdavd + remote viewer's folder sharing is another way to transfer files between host and guest.