spapr: move the interrupt presenters under machine_data
[qemu/ar7.git] / qemu-nbd.texi
blob386bece468073f1d60f8901fa0d4115a59d01c13
1 @example
2 @c man begin SYNOPSIS
3 @command{qemu-nbd} [OPTION]... @var{filename}
5 @command{qemu-nbd} @option{-L} [OPTION]...
7 @command{qemu-nbd} @option{-d} @var{dev}
8 @c man end
9 @end example
11 @c man begin DESCRIPTION
13 Export a QEMU disk image using the NBD protocol.
15 Other uses:
16 @itemize
17 @item
18 Bind a /dev/nbdX block device to a QEMU server (on Linux).
19 @item
20 As a client to query exports of a remote NBD server.
21 @end itemize
23 @c man end
25 @c man begin OPTIONS
26 @var{filename} is a disk image filename, or a set of block
27 driver options if @option{--image-opts} is specified.
29 @var{dev} is an NBD device.
31 @table @option
32 @item --object type,id=@var{id},...props...
33 Define a new instance of the @var{type} object class identified by @var{id}.
34 See the @code{qemu(1)} manual page for full details of the properties
35 supported. The common object types that it makes sense to define are the
36 @code{secret} object, which is used to supply passwords and/or encryption
37 keys, and the @code{tls-creds} object, which is used to supply TLS
38 credentials for the qemu-nbd server or client.
39 @item -p, --port=@var{port}
40 The TCP port to listen on as a server, or connect to as a client
41 (default @samp{10809}).
42 @item -o, --offset=@var{offset}
43 The offset into the image.
44 @item -b, --bind=@var{iface}
45 The interface to bind to as a server, or connect to as a client
46 (default @samp{0.0.0.0}).
47 @item -k, --socket=@var{path}
48 Use a unix socket with path @var{path}.
49 @item --image-opts
50 Treat @var{filename} as a set of image options, instead of a plain
51 filename. If this flag is specified, the @var{-f} flag should
52 not be used, instead the '@code{format=}' option should be set.
53 @item -f, --format=@var{fmt}
54 Force the use of the block driver for format @var{fmt} instead of
55 auto-detecting.
56 @item -r, --read-only
57 Export the disk as read-only.
58 @item -P, --partition=@var{num}
59 Only expose MBR partition @var{num}.  Understands physical partitions
60 1-4 and logical partitions 5-8.
61 @item -B, --bitmap=@var{name}
62 If @var{filename} has a qcow2 persistent bitmap @var{name}, expose
63 that bitmap via the ``qemu:dirty-bitmap:@var{name}'' context
64 accessible through NBD_OPT_SET_META_CONTEXT.
65 @item -s, --snapshot
66 Use @var{filename} as an external snapshot, create a temporary
67 file with backing_file=@var{filename}, redirect the write to
68 the temporary one.
69 @item -l, --load-snapshot=@var{snapshot_param}
70 Load an internal snapshot inside @var{filename} and export it
71 as an read-only device, @var{snapshot_param} format is
72 'snapshot.id=[ID],snapshot.name=[NAME]' or '[ID_OR_NAME]'
73 @item -n, --nocache
74 @itemx --cache=@var{cache}
75 The cache mode to be used with the file.  See the documentation of
76 the emulator's @code{-drive cache=...} option for allowed values.
77 @item --aio=@var{aio}
78 Set the asynchronous I/O mode between @samp{threads} (the default)
79 and @samp{native} (Linux only).
80 @item --discard=@var{discard}
81 Control whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap})
82 requests are ignored or passed to the filesystem.  @var{discard} is one of
83 @samp{ignore} (or @samp{off}), @samp{unmap} (or @samp{on}).  The default is
84 @samp{ignore}.
85 @item --detect-zeroes=@var{detect-zeroes}
86 Control the automatic conversion of plain zero writes by the OS to
87 driver-specific optimized zero write commands.  @var{detect-zeroes} is one of
88 @samp{off}, @samp{on} or @samp{unmap}.  @samp{unmap}
89 converts a zero write to an unmap operation and can only be used if
90 @var{discard} is set to @samp{unmap}.  The default is @samp{off}.
91 @item -c, --connect=@var{dev}
92 Connect @var{filename} to NBD device @var{dev} (Linux only).
93 @item -d, --disconnect
94 Disconnect the device @var{dev} (Linux only).
95 @item -e, --shared=@var{num}
96 Allow up to @var{num} clients to share the device (default
97 @samp{1}). Safe for readers, but for now, consistency is not
98 guaranteed between multiple writers.
99 @item -t, --persistent
100 Don't exit on the last connection.
101 @item -x, --export-name=@var{name}
102 Set the NBD volume export name (default of a zero-length string).
103 @item -D, --description=@var{description}
104 Set the NBD volume export description, as a human-readable
105 string.
106 @item -L, --list
107 Connect as a client and list all details about the exports exposed by
108 a remote NBD server.  This enables list mode, and is incompatible
109 with options that change behavior related to a specific export (such as
110 @option{--export-name}, @option{--offset}, ...).
111 @item --tls-creds=ID
112 Enable mandatory TLS encryption for the server by setting the ID
113 of the TLS credentials object previously created with the --object
114 option; or provide the credentials needed for connecting as a client
115 in list mode.
116 @item --fork
117 Fork off the server process and exit the parent once the server is running.
118 @item -v, --verbose
119 Display extra debugging information.
120 @item -h, --help
121 Display this help and exit.
122 @item -V, --version
123 Display version information and exit.
124 @item -T, --trace [[enable=]@var{pattern}][,events=@var{file}][,file=@var{file}]
125 @findex --trace
126 @include qemu-option-trace.texi
127 @end table
129 @c man end
131 @c man begin EXAMPLES
132 Start a server listening on port 10809 that exposes only the
133 guest-visible contents of a qcow2 file, with no TLS encryption, and
134 with the default export name (an empty string). The command is
135 one-shot, and will block until the first successful client
136 disconnects:
138 @example
139 qemu-nbd -f qcow2 file.qcow2
140 @end example
142 Start a long-running server listening with encryption on port 10810,
143 and require clients to have a correct X.509 certificate to connect to
144 a 1 megabyte subset of a raw file, using the export name 'subset':
146 @example
147 qemu-nbd \
148   --object tls-creds-x509,id=tls0,endpoint=server,dir=/path/to/qemutls \
149   --tls-creds tls0 -t -x subset -p 10810 \
150   --image-opts driver=raw,offset=1M,size=1M,file.driver=file,file.filename=file.raw
151 @end example
153 Serve a read-only copy of just the first MBR partition of a guest
154 image over a Unix socket with as many as 5 simultaneous readers, with
155 a persistent process forked as a daemon:
157 @example
158 qemu-nbd --fork --persistent --shared=5 --socket=/path/to/sock \
159   --partition=1 --read-only --format=qcow2 file.qcow2
160 @end example
162 Expose the guest-visible contents of a qcow2 file via a block device
163 /dev/nbd0 (and possibly creating /dev/nbd0p1 and friends for
164 partitions found within), then disconnect the device when done.
165 Access to bind qemu-nbd to an /dev/nbd device generally requires root
166 privileges, and may also require the execution of @code{modprobe nbd}
167 to enable the kernel NBD client module.  @emph{CAUTION}: Do not use
168 this method to mount filesystems from an untrusted guest image - a
169 malicious guest may have prepared the image to attempt to trigger
170 kernel bugs in partition probing or file system mounting.
172 @example
173 qemu-nbd -c /dev/nbd0 -f qcow2 file.qcow2
174 qemu-nbd -d /dev/nbd0
175 @end example
177 Query a remote server to see details about what export(s) it is
178 serving on port 10809, and authenticating via PSK:
180 @example
181 qemu-nbd \
182   --object tls-creds-psk,id=tls0,dir=/tmp/keys,username=eblake,endpoint=client \
183   --tls-creds tls0 -L -b remote.example.com
184 @end example
186 @c man end
188 @ignore
190 @setfilename qemu-nbd
191 @settitle QEMU Disk Network Block Device Server
193 @c man begin AUTHOR
194 Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>.
195 This is free software; see the source for copying conditions.  There is NO
196 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
197 @c man end
199 @c man begin SEEALSO
200 qemu(1), qemu-img(1)
201 @c man end
203 @end ignore