]> git.proxmox.com Git - qemu.git/blame - qemu-img.texi
usb-uhci: Use PCI DMA stub functions
[qemu.git] / qemu-img.texi
CommitLineData
acd935ef
FB
1@example
2@c man begin SYNOPSIS
3usage: qemu-img command [command options]
4@c man end
5@end example
6
7@c man begin OPTIONS
8
9The following commands are supported:
153859be
SB
10
11@include qemu-img-cmds.texi
acd935ef
FB
12
13Command parameters:
14@table @var
15@item filename
16 is a disk image filename
5fafdf24 17@item fmt
f932c040
KW
18is the disk image format. It is guessed automatically in most cases. See below
19for a description of the supported disk formats.
acd935ef 20
5fafdf24 21@item size
eff44266
KW
22is the disk image size in bytes. Optional suffixes @code{k} or @code{K}
23(kilobyte, 1024) @code{M} (megabyte, 1024k) and @code{G} (gigabyte, 1024M)
24and T (terabyte, 1024G) are supported. @code{b} is ignored.
acd935ef
FB
25
26@item output_filename
5fafdf24 27is the destination disk image filename
acd935ef
FB
28
29@item output_fmt
30 is the destination format
eff44266
KW
31@item options
32is a comma separated list of format specific options in a
33name=value format. Use @code{-o ?} for an overview of the options supported
3e032364 34by the used format or see the format descriptions below for details.
eff44266 35
acd935ef
FB
36
37@item -c
38indicates that target image must be compressed (qcow format only)
d2c639d6
BS
39@item -h
40with or without a command shows help and lists the supported formats
aaf55b47
JS
41@item -p
42display progress bar (convert and rebase commands only)
a22f123c
KW
43@item -S @var{size}
44indicates the consecutive number of bytes that must contain only zeros
45for qemu-img to create a sparse image during conversion. This value is rounded
46down to the nearest 512 bytes. You may use the common size suffixes like
47@code{k} for kilobytes.
d2c639d6
BS
48@end table
49
50Parameters to snapshot subcommand:
51
52@table @option
53
54@item snapshot
55is the name of the snapshot to create, apply or delete
56@item -a
57applies a snapshot (revert disk to saved state)
58@item -c
59creates a snapshot
60@item -d
61deletes a snapshot
62@item -l
63lists all snapshots in the given image
acd935ef
FB
64@end table
65
66Command description:
67
68@table @option
e6184690
KW
69@item check [-f @var{fmt}] @var{filename}
70
71Perform a consistency check on the disk image @var{filename}.
72
73Only the formats @code{qcow2}, @code{qed} and @code{vdi} support
74consistency checks.
75
8063d0fe 76@item create [-f @var{fmt}] [-o @var{options}] @var{filename} [@var{size}]
acd935ef
FB
77
78Create the new disk image @var{filename} of size @var{size} and format
8063d0fe
KW
79@var{fmt}. Depending on the file format, you can add one or more @var{options}
80that enable additional features of this format.
acd935ef 81
8063d0fe
KW
82If the option @var{backing_file} is specified, then the image will record
83only the differences from @var{backing_file}. No size needs to be specified in
84this case. @var{backing_file} will never be modified unless you use the
85@code{commit} monitor command (or qemu-img commit).
acd935ef 86
eff44266
KW
87The size can also be specified using the @var{size} option with @code{-o},
88it doesn't need to be specified separately in this case.
89
acd935ef
FB
90@item commit [-f @var{fmt}] @var{filename}
91
92Commit the changes recorded in @var{filename} in its base image.
93
a22f123c 94@item convert [-c] [-p] [-f @var{fmt}] [-O @var{output_fmt}] [-o @var{options}] [-s @var{snapshot_name}] [-S @var{sparse_size}] @var{filename} [@var{filename2} [...]] @var{output_filename}
acd935ef 95
51ef6727 96Convert the disk image @var{filename} or a snapshot @var{snapshot_name} to disk image @var{output_filename}
eff44266
KW
97using format @var{output_fmt}. It can be optionally compressed (@code{-c}
98option) or use any format specific options like encryption (@code{-o} option).
acd935ef 99
8063d0fe 100Only the formats @code{qcow} and @code{qcow2} support compression. The
acd935ef
FB
101compression is read-only. It means that if a compressed sector is
102rewritten, then it is rewritten as uncompressed data.
103
acd935ef
FB
104Image conversion is also useful to get smaller image when using a
105growable format such as @code{qcow} or @code{cow}: the empty sectors
106are detected and suppressed from the destination image.
107
8063d0fe
KW
108You can use the @var{backing_file} option to force the output image to be
109created as a copy on write image of the specified base image; the
110@var{backing_file} should have the same content as the input's base image,
111however the path, image format, etc may differ.
112
acd935ef
FB
113@item info [-f @var{fmt}] @var{filename}
114
115Give information about the disk image @var{filename}. Use it in
116particular to know the size reserved on disk which can be different
19d36792
FB
117from the displayed size. If VM snapshots are stored in the disk image,
118they are displayed too.
d2c639d6
BS
119
120@item snapshot [-l | -a @var{snapshot} | -c @var{snapshot} | -d @var{snapshot} ] @var{filename}
121
122List, apply, create or delete snapshots in image @var{filename}.
ae6b0ed6 123
aaf55b47 124@item rebase [-f @var{fmt}] [-p] [-u] -b @var{backing_file} [-F @var{backing_fmt}] @var{filename}
e6184690
KW
125
126Changes the backing file of an image. Only the formats @code{qcow2} and
127@code{qed} support changing the backing file.
128
129The backing file is changed to @var{backing_file} and (if the image format of
130@var{filename} supports this) the backing file format is changed to
131@var{backing_fmt}.
132
133There are two different modes in which @code{rebase} can operate:
134@table @option
135@item Safe mode
136This is the default mode and performs a real rebase operation. The new backing
137file may differ from the old one and qemu-img rebase will take care of keeping
138the guest-visible content of @var{filename} unchanged.
139
140In order to achieve this, any clusters that differ between @var{backing_file}
141and the old backing file of @var{filename} are merged into @var{filename}
142before actually changing the backing file.
143
144Note that the safe mode is an expensive operation, comparable to converting
145an image. It only works if the old backing file still exists.
146
147@item Unsafe mode
148qemu-img uses the unsafe mode if @code{-u} is specified. In this mode, only the
149backing file name and format of @var{filename} is changed without any checks
150on the file contents. The user must take care of specifying the correct new
151backing file, or the guest-visible content of the image will be corrupted.
152
153This mode is useful for renaming or moving the backing file to somewhere else.
154It can be used without an accessible old backing file, i.e. you can use it to
155fix an image whose backing file has already been moved/renamed.
156@end table
157
ae6b0ed6
SH
158@item resize @var{filename} [+ | -]@var{size}
159
160Change the disk image as if it had been created with @var{size}.
161
162Before using this command to shrink a disk image, you MUST use file system and
163partitioning tools inside the VM to reduce allocated file systems and partition
164sizes accordingly. Failure to do so will result in data loss!
165
166After using this command to grow a disk image, you must use file system and
167partitioning tools inside the VM to actually begin using the new space on the
168device.
acd935ef
FB
169@end table
170
f932c040
KW
171Supported image file formats:
172
173@table @option
174@item raw
175
176Raw disk image format (default). This format has the advantage of
177being simple and easily exportable to all other emulators. If your
178file system supports @emph{holes} (for example in ext2 or ext3 on
179Linux or NTFS on Windows), then only the written sectors will reserve
180space. Use @code{qemu-img info} to know the real size used by the
181image or @code{ls -ls} on Unix/Linux.
182
f932c040
KW
183@item qcow2
184QEMU image format, the most versatile format. Use it to have smaller
185images (useful if your filesystem does not supports holes, for example
186on Windows), optional AES encryption, zlib based compression and
187support of multiple VM snapshots.
8063d0fe 188
3e032364
KW
189Supported options:
190@table @code
191@item backing_file
192File name of a base image (see @option{create} subcommand)
193@item backing_fmt
194Image format of the base image
195@item encryption
196If this option is set to @code{on}, the image is encrypted.
197
8063d0fe
KW
198Encryption uses the AES format which is very secure (128 bit keys). Use
199a long password (16 characters) to get maximum protection.
3e032364
KW
200
201@item cluster_size
202Changes the qcow2 cluster size (must be between 512 and 2M). Smaller cluster
203sizes can improve the image file size whereas larger cluster sizes generally
204provide better performance.
205
206@item preallocation
207Preallocation mode (allowed values: off, metadata). An image with preallocated
208metadata is initially larger but can improve performance when the image needs
209to grow.
210
211@end table
212
213
f932c040
KW
214@item qcow
215Old QEMU image format. Left for compatibility.
3e032364
KW
216
217Supported options:
218@table @code
219@item backing_file
220File name of a base image (see @option{create} subcommand)
221@item encryption
222If this option is set to @code{on}, the image is encrypted.
223@end table
224
f932c040
KW
225@item cow
226User Mode Linux Copy On Write image format. Used to be the only growable
227image format in QEMU. It is supported only for compatibility with
228previous versions. It does not work on win32.
229@item vdi
230VirtualBox 1.1 compatible image format.
231@item vmdk
232VMware 3 and 4 compatible image format.
3e032364
KW
233
234Supported options:
235@table @code
236@item backing_fmt
237Image format of the base image
238@item compat6
239Create a VMDK version 6 image (instead of version 4)
240@end table
241
242@item vpc
243VirtualPC compatible image format (VHD).
244
f932c040
KW
245@item cloop
246Linux Compressed Loop image, useful only to reuse directly compressed
247CD-ROM images present for example in the Knoppix CD-ROMs.
248@end table
249
250
acd935ef
FB
251@c man end
252
253@ignore
254
255@setfilename qemu-img
256@settitle QEMU disk image utility
257
258@c man begin SEEALSO
259The HTML documentation of QEMU for more precise information and Linux
260user mode emulator invocation.
261@c man end
262
263@c man begin AUTHOR
264Fabrice Bellard
265@c man end
266
267@end ignore