Statistics
| Branch: | Revision:

root / qemu-img.texi @ 02854532

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