1QEMU-IMG(1) QEMU-IMG(1)
2
3
4
6 qemu-img - QEMU disk image utility
7
9 usage: qemu-img command [command options]
10
12 The following commands are supported:
13
14 check [-f fmt] filename
15 create [-f fmt] [-o options] filename [size]
16 commit [-f fmt] filename
17 convert [-c] [-f fmt] [-O output_fmt] [-o options] filename [filename2
18 [...]] output_filename
19 info [-f fmt] filename
20 snapshot [-l | -a snapshot | -c snapshot | -d snapshot] filename
21 rebase [-f fmt] [-u] -b backing_file [-F backing_fmt] filename
22 resize filename [+ | -]size
23
24 Command parameters:
25
26 filename
27 is a disk image filename
28
29 fmt is the disk image format. It is guessed automatically in most
30 cases. See below for a description of the supported disk formats.
31
32 size
33 is the disk image size in bytes. Optional suffixes "k" or "K"
34 (kilobyte, 1024) "M" (megabyte, 1024k) and "G" (gigabyte, 1024M)
35 and T (terabyte, 1024G) are supported. "b" is ignored.
36
37 output_filename
38 is the destination disk image filename
39
40 output_fmt
41 is the destination format
42
43 options
44 is a comma separated list of format specific options in a
45 name=value format. Use "-o ?" for an overview of the options
46 supported by the used format or see the format descriptions below
47 for details.
48
49 -c indicates that target image must be compressed (qcow format only)
50
51 -h with or without a command shows help and lists the supported
52 formats
53
54 Parameters to snapshot subcommand:
55
56 snapshot
57 is the name of the snapshot to create, apply or delete
58
59 -a applies a snapshot (revert disk to saved state)
60
61 -c creates a snapshot
62
63 -d deletes a snapshot
64
65 -l lists all snapshots in the given image
66
67 Command description:
68
69 create [-f fmt] [-o options] filename [size]
70 Create the new disk image filename of size size and format fmt.
71 Depending on the file format, you can add one or more options that
72 enable additional features of this format.
73
74 If the option backing_file is specified, then the image will record
75 only the differences from backing_file. No size needs to be
76 specified in this case. backing_file will never be modified unless
77 you use the "commit" monitor command (or qemu-img commit).
78
79 The size can also be specified using the size option with "-o", it
80 doesn't need to be specified separately in this case.
81
82 commit [-f fmt] filename
83 Commit the changes recorded in filename in its base image.
84
85 convert [-c] [-f fmt] [-O output_fmt] [-o options] filename [filename2
86 [...]] output_filename
87 Convert the disk image filename to disk image output_filename using
88 format output_fmt. It can be optionally compressed ("-c" option) or
89 use any format specific options like encryption ("-o" option).
90
91 Only the formats "qcow" and "qcow2" support compression. The
92 compression is read-only. It means that if a compressed sector is
93 rewritten, then it is rewritten as uncompressed data.
94
95 Image conversion is also useful to get smaller image when using a
96 growable format such as "qcow" or "cow": the empty sectors are
97 detected and suppressed from the destination image.
98
99 You can use the backing_file option to force the output image to be
100 created as a copy on write image of the specified base image; the
101 backing_file should have the same content as the input's base
102 image, however the path, image format, etc may differ.
103
104 info [-f fmt] filename
105 Give information about the disk image filename. Use it in
106 particular to know the size reserved on disk which can be different
107 from the displayed size. If VM snapshots are stored in the disk
108 image, they are displayed too.
109
110 snapshot [-l | -a snapshot | -c snapshot | -d snapshot ] filename
111 List, apply, create or delete snapshots in image filename.
112
113 resize filename [+ | -]size
114 Change the disk image as if it had been created with size.
115
116 Before using this command to shrink a disk image, you MUST use file
117 system and partitioning tools inside the VM to reduce allocated
118 file systems and partition sizes accordingly. Failure to do so
119 will result in data loss!
120
121 After using this command to grow a disk image, you must use file
122 system and partitioning tools inside the VM to actually begin using
123 the new space on the device.
124
125 Supported image file formats:
126
127 raw Raw disk image format (default). This format has the advantage of
128 being simple and easily exportable to all other emulators. If your
129 file system supports holes (for example in ext2 or ext3 on Linux or
130 NTFS on Windows), then only the written sectors will reserve space.
131 Use "qemu-img info" to know the real size used by the image or "ls
132 -ls" on Unix/Linux.
133
134 host_device
135 Host device format. This format should be used instead of raw when
136 converting to block devices or other devices where "holes" are not
137 supported.
138
139 qcow2
140 QEMU image format, the most versatile format. Use it to have
141 smaller images (useful if your filesystem does not supports holes,
142 for example on Windows), optional AES encryption, zlib based
143 compression and support of multiple VM snapshots.
144
145 Supported options:
146
147 "backing_file"
148 File name of a base image (see create subcommand)
149
150 "backing_fmt"
151 Image format of the base image
152
153 "encryption"
154 If this option is set to "on", the image is encrypted.
155
156 Encryption uses the AES format which is very secure (128 bit
157 keys). Use a long password (16 characters) to get maximum
158 protection.
159
160 "cluster_size"
161 Changes the qcow2 cluster size (must be between 512 and 2M).
162 Smaller cluster sizes can improve the image file size whereas
163 larger cluster sizes generally provide better performance.
164
165 "preallocation"
166 Preallocation mode (allowed values: off, metadata). An image
167 with preallocated metadata is initially larger but can improve
168 performance when the image needs to grow.
169
170 qcow
171 Old QEMU image format. Left for compatibility.
172
173 Supported options:
174
175 "backing_file"
176 File name of a base image (see create subcommand)
177
178 "encryption"
179 If this option is set to "on", the image is encrypted.
180
181 cow User Mode Linux Copy On Write image format. Used to be the only
182 growable image format in QEMU. It is supported only for
183 compatibility with previous versions. It does not work on win32.
184
185 vdi VirtualBox 1.1 compatible image format.
186
187 vmdk
188 VMware 3 and 4 compatible image format.
189
190 Supported options:
191
192 "backing_fmt"
193 Image format of the base image
194
195 "compat6"
196 Create a VMDK version 6 image (instead of version 4)
197
198 vpc VirtualPC compatible image format (VHD).
199
200 cloop
201 Linux Compressed Loop image, useful only to reuse directly
202 compressed CD-ROM images present for example in the Knoppix CD-
203 ROMs.
204
206 The HTML documentation of QEMU for more precise information and Linux
207 user mode emulator invocation.
208
210 Fabrice Bellard
211
212
213
214 2010-10-19 QEMU-IMG(1)