Statistics
| Branch: | Revision:

root / qemu-img.texi @ c2162a8b

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