1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
####
QEMU
####
Basic VM command
================
.. code-block:: bash
#!/bin/sh
exec qemu-system-x86_64 \
-machine type=q35,accel=kvm \
-enable-kvm \
-cpu host \
-smp cores=6,threads=2,sockets=1 \
-m 8G \
-drive file=ubuntu.qcow2,format=qcow2 \
-netdev user,id=mynet0 \
-device e1000,netdev=mynet0 \
-device qemu-xhci,id=xhci \
-device usb-tablet,bus=xhci.0 \
-usb \
-device usb-ehci,id=ehci \
-device usb-host,bus=usb-bus.0,hostbus=1,hostport=1 \
-device intel-hda \
-device hda-duplex \
-name Ubuntu \
-boot d \
-monitor stdio \
-display none \
"$@"
.. admonition:: TODO
Describe the command and split into parts and move them apart in sepatate
sections.
Exchange files with the host using samba [#shared-folder]_
==========================================================
When running QEMU, add the following options to the ``qemu-system-x86_64``
invocation command::
-netdev user,smb="/path/to/shared/directory",id=mynet0 \
-device e1000,netdev=mynet0 \
The shared directory can be mounted by a guest Linux machine like this::
mount -t cifs //10.0.2.4/qemu <mountpoint> -o user=<user>,pass=<password>
The ``<user>`` and the ``<password>`` can be almost *anything* existing or not,
even nothing, you even can provide just ``-o user=,pass=``.
The ``-t cifs`` part might be optional if ``mount`` supports inferring file
system type.
To mount it via ``/etc/fstab`` add the following line to the file::
//10.0.2.4/qemu <mountpoint> cifs user=<user>,pass=<password> 0 0
On Windows you can just enter the following address into explorer's address
bar, no authentication required::
\\10.2.0.4\qemu
Overall it looks like this:
.. image:: windows-guest-explorer-exe-qemu-samba.png
.. [#shared-folder] `Shared folder between QEMU Windows guest and Linux host / stackexchange.com <https://unix.stackexchange.com/a/183609>`_
|