Statistics
| Branch: | Revision:

root / qemu-img.texi @ 2a2af967

History | View | Annotate | Download (9.1 kB)

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