221
225
@option{cache=writeback} should be used with qcow2.
223
227
In case you don't care about data integrity over host failures, use
224
cache=unsafe. This option tells qemu that it never needs to write any data
228
cache=unsafe. This option tells QEMU that it never needs to write any data
225
229
to the disk but can instead keeps things in cache. If anything goes wrong,
226
230
like your host losing power, the disk storage getting disconnected accidentally,
227
231
etc. you're image will most probably be rendered unusable. When using
234
238
Instead of @option{-cdrom} you can use:
236
qemu -drive file=file,index=2,media=cdrom
240
qemu-system-i386 -drive file=file,index=2,media=cdrom
239
243
Instead of @option{-hda}, @option{-hdb}, @option{-hdc}, @option{-hdd}, you can
242
qemu -drive file=file,index=0,media=disk
243
qemu -drive file=file,index=1,media=disk
244
qemu -drive file=file,index=2,media=disk
245
qemu -drive file=file,index=3,media=disk
246
qemu-system-i386 -drive file=file,index=0,media=disk
247
qemu-system-i386 -drive file=file,index=1,media=disk
248
qemu-system-i386 -drive file=file,index=2,media=disk
249
qemu-system-i386 -drive file=file,index=3,media=disk
248
252
You can connect a CDROM to the slave of ide0:
250
qemu -drive file=file,if=ide,index=1,media=cdrom
254
qemu-system-i386 -drive file=file,if=ide,index=1,media=cdrom
253
257
If you don't specify the "file=" argument, you define an empty drive:
255
qemu -drive if=ide,index=1,media=cdrom
259
qemu-system-i386 -drive if=ide,index=1,media=cdrom
258
262
You can connect a SCSI disk with unit ID 6 on the bus #0:
260
qemu -drive file=file,if=scsi,bus=0,unit=6
264
qemu-system-i386 -drive file=file,if=scsi,bus=0,unit=6
263
267
Instead of @option{-fda}, @option{-fdb}, you can use:
265
qemu -drive file=file,index=0,if=floppy
266
qemu -drive file=file,index=1,if=floppy
269
qemu-system-i386 -drive file=file,index=0,if=floppy
270
qemu-system-i386 -drive file=file,index=1,if=floppy
269
273
By default, @var{interface} is "ide" and @var{index} is automatically
272
qemu -drive file=a -drive file=b"
276
qemu-system-i386 -drive file=a -drive file=b"
274
278
is interpreted like:
280
qemu-system-i386 -hda a -hdb b
290
294
DEF("global", HAS_ARG, QEMU_OPTION_global,
291
"-global driver.property=value\n"
295
"-global driver.prop=value\n"
292
296
" set a global default for a driver property\n",
299
@item -global @var{driver}.@var{prop}=@var{value}
301
Set default value of @var{driver}'s property @var{prop} to @var{value}, e.g.:
304
qemu-system-i386 -global ide-drive.physical_block_size=4096 -drive file=file,if=ide,index=0,media=disk
307
In particular, you can use this to set driver properties for devices which are
308
created automatically by the machine model. To create a device which is not
309
created automatically and set properties on it, use -@option{device}.
300
312
DEF("mtdblock", HAS_ARG, QEMU_OPTION_mtdblock,
353
365
# try to boot from network first, then from hard disk
366
qemu-system-i386 -boot order=nc
355
367
# boot from CD-ROM first, switch back to default order after reboot
368
qemu-system-i386 -boot once=d
357
369
# boot with a splash picture for 5 seconds.
358
qemu -boot menu=on,splash=/root/boot.bmp,splash-time=5000
370
qemu-system-i386 -boot menu=on,splash=/root/boot.bmp,splash-time=5000
361
373
Note: The legacy format '-boot @var{drives}' is still supported but its
446
458
available sound hardware.
449
qemu -soundhw sb16,adlib disk.img
450
qemu -soundhw es1370 disk.img
451
qemu -soundhw ac97 disk.img
452
qemu -soundhw hda disk.img
453
qemu -soundhw all disk.img
461
qemu-system-i386 -soundhw sb16,adlib disk.img
462
qemu-system-i386 -soundhw es1370 disk.img
463
qemu-system-i386 -soundhw ac97 disk.img
464
qemu-system-i386 -soundhw hda disk.img
465
qemu-system-i386 -soundhw all disk.img
466
qemu-system-i386 -soundhw ?
457
469
Note that Linux's i810_audio OSS kernel (for AC97) module might
579
591
Specifies the security model to be used for this export path.
580
592
Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none".
581
593
In "passthrough" security model, files are stored using the same
582
credentials as they are created on the guest. This requires qemu
594
credentials as they are created on the guest. This requires QEMU
583
595
to run as root. In "mapped-xattr" security model, some of the file
584
596
attributes like uid, gid, mode bits and link target are stored as
585
597
file attributes. For "mapped-file" these attributes are stored in the
646
658
Specifies the security model to be used for this export path.
647
659
Supported security models are "passthrough", "mapped-xattr", "mapped-file" and "none".
648
660
In "passthrough" security model, files are stored using the same
649
credentials as they are created on the guest. This requires qemu
661
credentials as they are created on the guest. This requires QEMU
650
662
to run as root. In "mapped-xattr" security model, some of the file
651
663
attributes like uid, gid, mode bits and link target are stored as
652
664
file attributes. For "mapped-file" these attributes are stored in the
1024
1036
Require that password based authentication is used for client connections.
1025
The password must be set separately using the @code{change} command in the
1038
The password must be set separately using the @code{set_password} command in
1039
the @ref{pcsys_monitor}. The syntax to change your password is:
1040
@code{set_password <protocol> <password>} where <protocol> could be either
1043
If you would like to change <protocol> password expiration, you should use
1044
@code{expire_password <protocol> <expiration-time>} where expiration time could
1045
be one of the following options: now, never, +seconds or UNIX time of
1046
expiration, e.g. +60 to make password expire in 60 seconds, or 1335196800
1047
to make password expire on "Mon Apr 23 12:00:00 EDT 2012" (UNIX time for this
1050
You can also use keywords "now" or "never" for the expiration time to
1051
allow <protocol> password to expire immediately or never expire.
1302
1327
Optionally, for PCI cards, you can specify the number @var{v} of MSI-X vectors
1303
1328
that the card should have; this option currently only affects virtio cards; set
1304
1329
@var{v} = 0 to disable MSI-X. If no @option{-net} option is specified, a single
1305
NIC is created. Qemu can emulate several different models of network card.
1330
NIC is created. QEMU can emulate several different models of network card.
1306
1331
Valid values for @var{type} are
1307
1332
@code{virtio}, @code{i82551}, @code{i82557b}, @code{i82559er},
1308
1333
@code{ne2k_pci}, @code{ne2k_isa}, @code{pcnet}, @code{rtl8139},
1413
1438
connect to the guest telnet server.
1415
1440
@item guestfwd=[tcp]:@var{server}:@var{port}-@var{dev}
1441
@item guestfwd=[tcp]:@var{server}:@var{port}-@var{cmd:command}
1416
1442
Forward guest TCP connections to the IP address @var{server} on port @var{port}
1417
to the character device @var{dev}. This option can be given multiple times.
1443
to the character device @var{dev} or to a program executed by @var{cmd:command}
1444
which gets spawned for each connection. This option can be given multiple times.
1446
You can either use a chardev directly and have that one used throughout QEMU's
1447
lifetime, like in the following example:
1450
# open 10.10.1.1:4321 on bootup, connect 10.0.2.100:1234 to it whenever
1451
# the guest accesses it
1452
qemu -net user,guestfwd=tcp:10.0.2.100:1234-tcp:10.10.1.1:4321 [...]
1455
Or you can execute a command on every TCP connection established by the guest,
1456
so that QEMU behaves similar to an inetd process for that virtual server:
1459
# call "netcat 10.10.1.1 4321" on every TCP connection to 10.0.2.100:1234
1460
# and connect the TCP stream to its stdin/stdout
1461
qemu -net 'user,guestfwd=tcp:10.0.2.100:1234-cmd:netcat 10.10.1.1 4321'
1446
1491
#launch a QEMU instance with the default network script
1447
qemu linux.img -net nic -net tap
1492
qemu-system-i386 linux.img -net nic -net tap
1451
1496
#launch a QEMU instance with two NICs, each one connected
1452
1497
#to a TAP device
1453
qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \
1454
-net nic,vlan=1 -net tap,vlan=1,ifname=tap1
1498
qemu-system-i386 linux.img \
1499
-net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \
1500
-net nic,vlan=1 -net tap,vlan=1,ifname=tap1
1458
1504
#launch a QEMU instance with the default network helper to
1459
1505
#connect a TAP device to bridge br0
1460
qemu linux.img -net nic -net tap,"helper=/usr/local/libexec/qemu-bridge-helper"
1506
qemu-system-i386 linux.img \
1507
-net nic -net tap,"helper=/usr/local/libexec/qemu-bridge-helper"
1463
1510
@item -net bridge[,vlan=@var{n}][,name=@var{name}][,br=@var{bridge}][,helper=@var{helper}]
1474
1521
#launch a QEMU instance with the default network helper to
1475
1522
#connect a TAP device to bridge br0
1476
qemu linux.img -net bridge -net nic,model=virtio
1523
qemu-system-i386 linux.img -net bridge -net nic,model=virtio
1480
1527
#launch a QEMU instance with the default network helper to
1481
1528
#connect a TAP device to bridge qemubr0
1482
qemu linux.img -net bridge,br=qemubr0 -net nic,model=virtio
1529
qemu-system-i386 linux.img -net bridge,br=qemubr0 -net nic,model=virtio
1485
1532
@item -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}] [,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}]
1496
1543
# launch a first QEMU instance
1497
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
1498
-net socket,listen=:1234
1544
qemu-system-i386 linux.img \
1545
-net nic,macaddr=52:54:00:12:34:56 \
1546
-net socket,listen=:1234
1499
1547
# connect the VLAN 0 of this instance to the VLAN 0
1500
1548
# of the first instance
1501
qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
1502
-net socket,connect=127.0.0.1:1234
1549
qemu-system-i386 linux.img \
1550
-net nic,macaddr=52:54:00:12:34:57 \
1551
-net socket,connect=127.0.0.1:1234
1505
1554
@item -net socket[,vlan=@var{n}][,name=@var{name}][,fd=@var{h}][,mcast=@var{maddr}:@var{port}[,localaddr=@var{addr}]]
1524
1573
# launch one QEMU instance
1525
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
1526
-net socket,mcast=230.0.0.1:1234
1574
qemu-system-i386 linux.img \
1575
-net nic,macaddr=52:54:00:12:34:56 \
1576
-net socket,mcast=230.0.0.1:1234
1527
1577
# launch another QEMU instance on same "bus"
1528
qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
1529
-net socket,mcast=230.0.0.1:1234
1578
qemu-system-i386 linux.img \
1579
-net nic,macaddr=52:54:00:12:34:57 \
1580
-net socket,mcast=230.0.0.1:1234
1530
1581
# launch yet another QEMU instance on same "bus"
1531
qemu linux.img -net nic,macaddr=52:54:00:12:34:58 \
1532
-net socket,mcast=230.0.0.1:1234
1582
qemu-system-i386 linux.img \
1583
-net nic,macaddr=52:54:00:12:34:58 \
1584
-net socket,mcast=230.0.0.1:1234
1535
1587
Example (User Mode Linux compat.):
1537
1589
# launch QEMU instance (note mcast address selected
1538
1590
# is UML's default)
1539
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
1540
-net socket,mcast=239.192.168.1:1102
1591
qemu-system-i386 linux.img \
1592
-net nic,macaddr=52:54:00:12:34:56 \
1593
-net socket,mcast=239.192.168.1:1102
1542
1595
/path/to/linux ubd0=/path/to/root_fs eth0=mcast
1545
1598
Example (send packets from host's 1.2.3.4):
1547
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
1548
-net socket,mcast=239.192.168.1:1102,localaddr=1.2.3.4
1600
qemu-system-i386 linux.img \
1601
-net nic,macaddr=52:54:00:12:34:56 \
1602
-net socket,mcast=239.192.168.1:1102,localaddr=1.2.3.4
1551
1605
@item -net vde[,vlan=@var{n}][,name=@var{name}][,sock=@var{socketpath}] [,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}]
1783
1837
@option{pty} is not available on Windows hosts.
1785
1839
@item -chardev stdio ,id=@var{id} [,signal=on|off]
1786
Connect to standard input and standard output of the qemu process.
1840
Connect to standard input and standard output of the QEMU process.
1788
1842
@option{signal} controls if signals are enabled on the terminal, that includes
1789
1843
exiting QEMU with the key sequence @key{Control-c}. This option is enabled by
1846
1900
Example (without authentication):
1848
qemu -iscsi initiator-name=iqn.2001-04.com.example:my-initiator \
1849
-cdrom iscsi://192.0.2.1/iqn.2001-04.com.example/2 \
1850
-drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1
1902
qemu-system-i386 -iscsi initiator-name=iqn.2001-04.com.example:my-initiator \
1903
-cdrom iscsi://192.0.2.1/iqn.2001-04.com.example/2 \
1904
-drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1
1853
1907
Example (CHAP username/password via URL):
1855
qemu -drive file=iscsi://user%password@@192.0.2.1/iqn.2001-04.com.example/1
1909
qemu-system-i386 -drive file=iscsi://user%password@@192.0.2.1/iqn.2001-04.com.example/1
1858
1912
Example (CHAP username/password via environment variables):
1860
1914
LIBISCSI_CHAP_USERNAME="user" \
1861
1915
LIBISCSI_CHAP_PASSWORD="password" \
1862
qemu -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1
1916
qemu-system-i386 -drive file=iscsi://192.0.2.1/iqn.2001-04.com.example/1
1865
1919
iSCSI support is an optional feature of QEMU and only available when
2111
2165
When not using a specified @var{src_port} a random port is automatically chosen.
2113
2167
If you just want a simple readonly console you can use @code{netcat} or
2114
@code{nc}, by starting qemu with: @code{-serial udp::4555} and nc as:
2115
@code{nc -u -l -p 4555}. Any time qemu writes something to that port it
2168
@code{nc}, by starting QEMU with: @code{-serial udp::4555} and nc as:
2169
@code{nc -u -l -p 4555}. Any time QEMU writes something to that port it
2116
2170
will appear in the netconsole session.
2118
2172
If you plan to send characters back via netconsole or you want to stop
2119
and start qemu a lot of times, you should have qemu use the same
2173
and start QEMU a lot of times, you should have QEMU use the same
2120
2174
source port each time by using something like @code{-serial
2121
udp::4555@@:4556} to qemu. Another approach is to use a patched
2175
udp::4555@@:4556} to QEMU. Another approach is to use a patched
2122
2176
version of netcat which can listen to a TCP port and send and receive
2123
2177
characters via udp. If you have a patched version of netcat which
2124
2178
activates telnet remote echo and single char transfer, then you can
2125
2179
use the following options to step up a netcat redirector to allow
2126
telnet on port 5555 to access the qemu port.
2180
telnet on port 5555 to access the QEMU port.
2129
2183
-serial udp::4555@@:4556
2130
2184
@item netcat options:
2131
2185
-u -P 4555 -L 0.0.0.0:4556 -t -p 5555 -I -T
2279
2333
Wait for gdb connection on device @var{dev} (@pxref{gdb_usage}). Typical
2280
2334
connections will likely be TCP-based, but also UDP, pseudo TTY, or even
2281
stdio are reasonable use case. The latter is allowing to start qemu from
2335
stdio are reasonable use case. The latter is allowing to start QEMU from
2282
2336
within gdb and establish the connection via a pipe:
2284
(gdb) target remote | exec qemu -gdb stdio ...
2338
(gdb) target remote | exec qemu-system-i386 -gdb stdio ...
2308
2362
"-D logfile output log to logfile (instead of the default /tmp/qemu.log)\n",
2365
@item -D @var{logfile}
2313
Output log in logfile instead of /tmp/qemu.log
2367
Output log in @var{logfile} instead of /tmp/qemu.log
2316
2370
DEF("hdachs", HAS_ARG, QEMU_OPTION_hdachs, \
2317
2371
"-hdachs c,h,s[,t]\n" \
2318
2372
" force hard disk 0 physical geometry and the optional BIOS\n" \
2319
" translation (t=none or lba) (usually qemu can guess them)\n",
2373
" translation (t=none or lba) (usually QEMU can guess them)\n",
2322
2376
@item -hdachs @var{c},@var{h},@var{s},[,@var{t}]
2445
2499
DEF("startdate", HAS_ARG, QEMU_OPTION_startdate, "", QEMU_ARCH_ALL)
2447
2501
DEF("rtc", HAS_ARG, QEMU_OPTION_rtc, \
2448
"-rtc [base=utc|localtime|date][,clock=host|vm][,driftfix=none|slew]\n" \
2502
"-rtc [base=utc|localtime|date][,clock=host|rt|vm][,driftfix=none|slew]\n" \
2449
2503
" set the RTC base and clock, enable drift fix for clock ticks (x86 only)\n",
2461
2515
By default the RTC is driven by the host system time. This allows to use the
2462
2516
RTC as accurate reference clock inside the guest, specifically if the host
2463
2517
time is smoothly following an accurate external reference clock, e.g. via NTP.
2464
If you want to isolate the guest time from the host, even prevent it from
2465
progressing during suspension, you can set @option{clock} to @code{vm} instead.
2518
If you want to isolate the guest time from the host, you can set @option{clock}
2519
to @code{rt} instead. To even prevent it from progressing during suspension,
2520
you can set it to @code{vm}.
2467
2522
Enable @option{driftfix} (i386 targets only) if you experience time drift problems,
2468
2523
specifically with Windows' ACPI HAL. This option will try to figure out how
2668
2728
@item -writeconfig @var{file}
2669
2729
@findex -writeconfig
2670
Write device configuration to @var{file}.
2730
Write device configuration to @var{file}. The @var{file} can be either filename to save
2731
command line and device configuration into file or dash @code{-}) character to print the
2732
output to stdout. This can be later used as input file for @code{-readconfig} option.
2672
2734
DEF("nodefconfig", 0, QEMU_OPTION_nodefconfig,
2673
2735
"-nodefconfig\n"
2677
2739
@item -nodefconfig
2678
2740
@findex -nodefconfig
2679
Normally QEMU loads a configuration file from @var{sysconfdir}/qemu.conf and
2680
@var{sysconfdir}/target-@var{ARCH}.conf on startup. The @code{-nodefconfig}
2681
option will prevent QEMU from loading these configuration files at startup.
2741
Normally QEMU loads configuration files from @var{sysconfdir} and @var{datadir} at startup.
2742
The @code{-nodefconfig} option will prevent QEMU from loading any of those config files.
2744
DEF("no-user-config", 0, QEMU_OPTION_nouserconfig,
2746
" do not load user-provided config files at startup\n",
2749
@item -no-user-config
2750
@findex -no-user-config
2751
The @code{-no-user-config} option makes QEMU not load any of the user-provided
2752
config files on @var{sysconfdir}, but won't make it skip the QEMU-provided config
2753
files from @var{datadir}.
2683
2755
DEF("trace", HAS_ARG, QEMU_OPTION_trace,
2684
2756
"-trace [events=<file>][,file=<file>]\n"
2782
DEF("qtest", HAS_ARG, QEMU_OPTION_qtest,
2783
"-qtest CHR specify tracing options\n",
2786
DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log,
2787
"-qtest-log LOG specify tracing options\n",
2791
DEF("enable-fips", 0, QEMU_OPTION_enablefips,
2792
"-enable-fips enable FIPS 140-2 compliance\n",
2797
@findex -enable-fips
2798
Enable FIPS 140-2 compliance mode.
2710
2801
HXCOMM This is the last statement. Insert new options before this line!