.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" ======================================================================== .\" .IX Title "QEMU-IMG 1" .TH QEMU-IMG 1 "2016-02-01" " " " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" qemu\-img \- QEMU disk image utility .SH "SYNOPSIS" .IX Header "SYNOPSIS" usage: qemu-img command [command options] .SH "DESCRIPTION" .IX Header "DESCRIPTION" qemu-img allows you to create, convert and modify images offline. It can handle all image formats supported by \s-1QEMU\s0. .PP \&\fBWarning:\fR Never use qemu-img to modify images in use by a running virtual machine or any other process; this may destroy the image. Also, be aware that querying an image that is being modified by another process may encounter inconsistent state. .SH "OPTIONS" .IX Header "OPTIONS" The following commands are supported: .IP "\fBcheck [\-f\fR \fIfmt\fR\fB]\fR \fIfilename\fR" 4 .IX Item "check [-f fmt] filename" .PD 0 .IP "\fBcreate [\-f\fR \fIfmt\fR\fB] [\-o\fR \fIoptions\fR\fB]\fR \fIfilename\fR \fB[\fR\fIsize\fR\fB]\fR" 4 .IX Item "create [-f fmt] [-o options] filename [size]" .IP "\fBcommit [\-f\fR \fIfmt\fR\fB] [\-t\fR \fIcache\fR\fB]\fR \fIfilename\fR" 4 .IX Item "commit [-f fmt] [-t cache] filename" .IP "\fBconvert [\-c] [\-p] [\-f\fR \fIfmt\fR\fB] [\-t\fR \fIcache\fR\fB] [\-O\fR \fIoutput_fmt\fR\fB] [\-o\fR \fIoptions\fR\fB] [\-s\fR \fIsnapshot_name\fR\fB] [\-S\fR \fIsparse_size\fR\fB]\fR \fIfilename\fR \fB[\fR\fIfilename2\fR \fB[...]]\fR \fIoutput_filename\fR" 4 .IX Item "convert [-c] [-p] [-f fmt] [-t cache] [-O output_fmt] [-o options] [-s snapshot_name] [-S sparse_size] filename [filename2 [...]] output_filename" .IP "\fBinfo [\-f\fR \fIfmt\fR\fB]\fR \fIfilename\fR" 4 .IX Item "info [-f fmt] filename" .IP "\fBsnapshot [\-l | \-a\fR \fIsnapshot\fR \fB| \-c\fR \fIsnapshot\fR \fB| \-d\fR \fIsnapshot\fR\fB]\fR \fIfilename\fR" 4 .IX Item "snapshot [-l | -a snapshot | -c snapshot | -d snapshot] filename" .IP "\fBrebase [\-f\fR \fIfmt\fR\fB] [\-t\fR \fIcache\fR\fB] [\-p] [\-u] \-b\fR \fIbacking_file\fR \fB[\-F\fR \fIbacking_fmt\fR\fB]\fR \fIfilename\fR" 4 .IX Item "rebase [-f fmt] [-t cache] [-p] [-u] -b backing_file [-F backing_fmt] filename" .IP "\fBresize\fR \fIfilename\fR \fB[+ | \-]\fR\fIsize\fR" 4 .IX Item "resize filename [+ | -]size" .PD .PP Command parameters: .IP "\fIfilename\fR" 4 .IX Item "filename" .Vb 1 \& is a disk image filename .Ve .IP "\fIfmt\fR" 4 .IX Item "fmt" is the disk image format. It is guessed automatically in most cases. See below for a description of the supported disk formats. .IP "\fIsize\fR" 4 .IX Item "size" is the disk image size in bytes. Optional suffixes \f(CW\*(C`k\*(C'\fR or \f(CW\*(C`K\*(C'\fR (kilobyte, 1024) \f(CW\*(C`M\*(C'\fR (megabyte, 1024k) and \f(CW\*(C`G\*(C'\fR (gigabyte, 1024M) and T (terabyte, 1024G) are supported. \f(CW\*(C`b\*(C'\fR is ignored. .IP "\fIoutput_filename\fR" 4 .IX Item "output_filename" is the destination disk image filename .IP "\fIoutput_fmt\fR" 4 .IX Item "output_fmt" .Vb 1 \& is the destination format .Ve .IP "\fIoptions\fR" 4 .IX Item "options" is a comma separated list of format specific options in a name=value format. Use \f(CW\*(C`\-o ?\*(C'\fR for an overview of the options supported by the used format or see the format descriptions below for details. .IP "\fI\-c\fR" 4 .IX Item "-c" indicates that target image must be compressed (qcow format only) .IP "\fI\-h\fR" 4 .IX Item "-h" with or without a command shows help and lists the supported formats .IP "\fI\-p\fR" 4 .IX Item "-p" display progress bar (convert and rebase commands only) .IP "\fI\-S\fR \fIsize\fR" 4 .IX Item "-S size" indicates the consecutive number of bytes that must contain only zeros for qemu-img to create a sparse image during conversion. This value is rounded down to the nearest 512 bytes. You may use the common size suffixes like \&\f(CW\*(C`k\*(C'\fR for kilobytes. .IP "\fI\-t\fR \fIcache\fR" 4 .IX Item "-t cache" specifies the cache mode that should be used with the (destination) file. See the documentation of the emulator's \f(CW\*(C`\-drive cache=...\*(C'\fR option for allowed values. .PP Parameters to snapshot subcommand: .IP "\fBsnapshot\fR" 4 .IX Item "snapshot" is the name of the snapshot to create, apply or delete .IP "\fB\-a\fR" 4 .IX Item "-a" applies a snapshot (revert disk to saved state) .IP "\fB\-c\fR" 4 .IX Item "-c" creates a snapshot .IP "\fB\-d\fR" 4 .IX Item "-d" deletes a snapshot .IP "\fB\-l\fR" 4 .IX Item "-l" lists all snapshots in the given image .PP Command description: .IP "\fBcheck [\-f\fR \fIfmt\fR\fB]\fR \fIfilename\fR" 4 .IX Item "check [-f fmt] filename" Perform a consistency check on the disk image \fIfilename\fR. .Sp Only the formats \f(CW\*(C`qcow2\*(C'\fR, \f(CW\*(C`qed\*(C'\fR and \f(CW\*(C`vdi\*(C'\fR support consistency checks. .IP "\fBcreate [\-f\fR \fIfmt\fR\fB] [\-o\fR \fIoptions\fR\fB]\fR \fIfilename\fR \fB[\fR\fIsize\fR\fB]\fR" 4 .IX Item "create [-f fmt] [-o options] filename [size]" Create the new disk image \fIfilename\fR of size \fIsize\fR and format \&\fIfmt\fR. Depending on the file format, you can add one or more \fIoptions\fR that enable additional features of this format. .Sp If the option \fIbacking_file\fR is specified, then the image will record only the differences from \fIbacking_file\fR. No size needs to be specified in this case. \fIbacking_file\fR will never be modified unless you use the \&\f(CW\*(C`commit\*(C'\fR monitor command (or qemu-img commit). .Sp The size can also be specified using the \fIsize\fR option with \f(CW\*(C`\-o\*(C'\fR, it doesn't need to be specified separately in this case. .IP "\fBcommit [\-f\fR \fIfmt\fR\fB] [\-t\fR \fIcache\fR\fB]\fR \fIfilename\fR" 4 .IX Item "commit [-f fmt] [-t cache] filename" Commit the changes recorded in \fIfilename\fR in its base image. .IP "\fBconvert [\-c] [\-p] [\-f\fR \fIfmt\fR\fB] [\-t\fR \fIcache\fR\fB] [\-O\fR \fIoutput_fmt\fR\fB] [\-o\fR \fIoptions\fR\fB] [\-s\fR \fIsnapshot_name\fR\fB] [\-S\fR \fIsparse_size\fR\fB]\fR \fIfilename\fR \fB[\fR\fIfilename2\fR \fB[...]]\fR \fIoutput_filename\fR" 4 .IX Item "convert [-c] [-p] [-f fmt] [-t cache] [-O output_fmt] [-o options] [-s snapshot_name] [-S sparse_size] filename [filename2 [...]] output_filename" Convert the disk image \fIfilename\fR or a snapshot \fIsnapshot_name\fR to disk image \fIoutput_filename\fR using format \fIoutput_fmt\fR. It can be optionally compressed (\f(CW\*(C`\-c\*(C'\fR option) or use any format specific options like encryption (\f(CW\*(C`\-o\*(C'\fR option). .Sp Only the formats \f(CW\*(C`qcow\*(C'\fR and \f(CW\*(C`qcow2\*(C'\fR support compression. The compression is read-only. It means that if a compressed sector is rewritten, then it is rewritten as uncompressed data. .Sp Image conversion is also useful to get smaller image when using a growable format such as \f(CW\*(C`qcow\*(C'\fR or \f(CW\*(C`cow\*(C'\fR: the empty sectors are detected and suppressed from the destination image. .Sp You can use the \fIbacking_file\fR option to force the output image to be created as a copy on write image of the specified base image; the \&\fIbacking_file\fR should have the same content as the input's base image, however the path, image format, etc may differ. .IP "\fBinfo [\-f\fR \fIfmt\fR\fB]\fR \fIfilename\fR" 4 .IX Item "info [-f fmt] filename" Give information about the disk image \fIfilename\fR. Use it in particular to know the size reserved on disk which can be different from the displayed size. If \s-1VM\s0 snapshots are stored in the disk image, they are displayed too. .IP "\fBsnapshot [\-l | \-a\fR \fIsnapshot\fR \fB| \-c\fR \fIsnapshot\fR \fB| \-d\fR \fIsnapshot\fR \fB]\fR \fIfilename\fR" 4 .IX Item "snapshot [-l | -a snapshot | -c snapshot | -d snapshot ] filename" List, apply, create or delete snapshots in image \fIfilename\fR. .IP "\fBrebase [\-f\fR \fIfmt\fR\fB] [\-t\fR \fIcache\fR\fB] [\-p] [\-u] \-b\fR \fIbacking_file\fR \fB[\-F\fR \fIbacking_fmt\fR\fB]\fR \fIfilename\fR" 4 .IX Item "rebase [-f fmt] [-t cache] [-p] [-u] -b backing_file [-F backing_fmt] filename" Changes the backing file of an image. Only the formats \f(CW\*(C`qcow2\*(C'\fR and \&\f(CW\*(C`qed\*(C'\fR support changing the backing file. .Sp The backing file is changed to \fIbacking_file\fR and (if the image format of \&\fIfilename\fR supports this) the backing file format is changed to \&\fIbacking_fmt\fR. .Sp There are two different modes in which \f(CW\*(C`rebase\*(C'\fR can operate: .RS 4 .IP "\fBSafe mode\fR" 4 .IX Item "Safe mode" This is the default mode and performs a real rebase operation. The new backing file may differ from the old one and qemu-img rebase will take care of keeping the guest-visible content of \fIfilename\fR unchanged. .Sp In order to achieve this, any clusters that differ between \fIbacking_file\fR and the old backing file of \fIfilename\fR are merged into \fIfilename\fR before actually changing the backing file. .Sp Note that the safe mode is an expensive operation, comparable to converting an image. It only works if the old backing file still exists. .IP "\fBUnsafe mode\fR" 4 .IX Item "Unsafe mode" qemu-img uses the unsafe mode if \f(CW\*(C`\-u\*(C'\fR is specified. In this mode, only the backing file name and format of \fIfilename\fR is changed without any checks on the file contents. The user must take care of specifying the correct new backing file, or the guest-visible content of the image will be corrupted. .Sp This mode is useful for renaming or moving the backing file to somewhere else. It can be used without an accessible old backing file, i.e. you can use it to fix an image whose backing file has already been moved/renamed. .RE .RS 4 .Sp You can use \f(CW\*(C`rebase\*(C'\fR to perform a \*(L"diff\*(R" operation on two disk images. This can be useful when you have copied or cloned a guest, and you want to get back to a thin image on top of a template or base image. .Sp Say that \f(CW\*(C`base.img\*(C'\fR has been cloned as \f(CW\*(C`modified.img\*(C'\fR by copying it, and that the \f(CW\*(C`modified.img\*(C'\fR guest has run so there are now some changes compared to \f(CW\*(C`base.img\*(C'\fR. To construct a thin image called \f(CW\*(C`diff.qcow2\*(C'\fR that contains just the differences, do: .Sp .Vb 2 \& qemu\-img create \-f qcow2 \-b modified.img diff.qcow2 \& qemu\-img rebase \-b base.img diff.qcow2 .Ve .Sp At this point, \f(CW\*(C`modified.img\*(C'\fR can be discarded, since \&\f(CW\*(C`base.img + diff.qcow2\*(C'\fR contains the same information. .RE .IP "\fBresize\fR \fIfilename\fR \fB[+ | \-]\fR\fIsize\fR" 4 .IX Item "resize filename [+ | -]size" Change the disk image as if it had been created with \fIsize\fR. .Sp Before using this command to shrink a disk image, you \s-1MUST\s0 use file system and partitioning tools inside the \s-1VM\s0 to reduce allocated file systems and partition sizes accordingly. Failure to do so will result in data loss! .Sp After using this command to grow a disk image, you must use file system and partitioning tools inside the \s-1VM\s0 to actually begin using the new space on the device. .PP Supported image file formats: .IP "\fBraw\fR" 4 .IX Item "raw" Raw disk image format (default). This format has the advantage of being simple and easily exportable to all other emulators. If your file system supports \fIholes\fR (for example in ext2 or ext3 on Linux or \s-1NTFS\s0 on Windows), then only the written sectors will reserve space. Use \f(CW\*(C`qemu\-img info\*(C'\fR to know the real size used by the image or \f(CW\*(C`ls \-ls\*(C'\fR on Unix/Linux. .IP "\fBqcow2\fR" 4 .IX Item "qcow2" \&\s-1QEMU\s0 image format, the most versatile format. Use it to have smaller images (useful if your filesystem does not supports holes, for example on Windows), optional \s-1AES\s0 encryption, zlib based compression and support of multiple \s-1VM\s0 snapshots. .Sp Supported options: .RS 4 .ie n .IP """backing_file""" 4 .el .IP "\f(CWbacking_file\fR" 4 .IX Item "backing_file" File name of a base image (see \fBcreate\fR subcommand) .ie n .IP """backing_fmt""" 4 .el .IP "\f(CWbacking_fmt\fR" 4 .IX Item "backing_fmt" Image format of the base image .ie n .IP """encryption""" 4 .el .IP "\f(CWencryption\fR" 4 .IX Item "encryption" If this option is set to \f(CW\*(C`on\*(C'\fR, the image is encrypted. .Sp Encryption uses the \s-1AES\s0 format which is very secure (128 bit keys). Use a long password (16 characters) to get maximum protection. .ie n .IP """cluster_size""" 4 .el .IP "\f(CWcluster_size\fR" 4 .IX Item "cluster_size" Changes the qcow2 cluster size (must be between 512 and 2M). Smaller cluster sizes can improve the image file size whereas larger cluster sizes generally provide better performance. .ie n .IP """preallocation""" 4 .el .IP "\f(CWpreallocation\fR" 4 .IX Item "preallocation" Preallocation mode (allowed values: off, metadata). An image with preallocated metadata is initially larger but can improve performance when the image needs to grow. .RE .RS 4 .RE .IP "\fBqed\fR" 4 .IX Item "qed" Image format with support for backing files and compact image files (when your filesystem or transport medium does not support holes). Good performance due to less metadata than the more featureful qcow2 format, especially with cache=writethrough or cache=directsync. Consider using qcow2 which will soon have a similar optimization and is most actively developed. .Sp Supported options: .RS 4 .ie n .IP """backing_file""" 4 .el .IP "\f(CWbacking_file\fR" 4 .IX Item "backing_file" File name of a base image (see \fBcreate\fR subcommand). .ie n .IP """backing_fmt""" 4 .el .IP "\f(CWbacking_fmt\fR" 4 .IX Item "backing_fmt" Image file format of backing file (optional). Useful if the format cannot be autodetected because it has no header, like some vhd/vpc files. .ie n .IP """cluster_size""" 4 .el .IP "\f(CWcluster_size\fR" 4 .IX Item "cluster_size" Changes the cluster size (must be power\-of\-2 between 4K and 64K). Smaller cluster sizes can improve the image file size whereas larger cluster sizes generally provide better performance. .ie n .IP """table_size""" 4 .el .IP "\f(CWtable_size\fR" 4 .IX Item "table_size" Changes the number of clusters per L1/L2 table (must be power\-of\-2 between 1 and 16). There is normally no need to change this value but this option can be used for performance benchmarking. .RE .RS 4 .RE .IP "\fBqcow\fR" 4 .IX Item "qcow" Old \s-1QEMU\s0 image format. Left for compatibility. .Sp Supported options: .RS 4 .ie n .IP """backing_file""" 4 .el .IP "\f(CWbacking_file\fR" 4 .IX Item "backing_file" File name of a base image (see \fBcreate\fR subcommand) .ie n .IP """encryption""" 4 .el .IP "\f(CWencryption\fR" 4 .IX Item "encryption" If this option is set to \f(CW\*(C`on\*(C'\fR, the image is encrypted. .RE .RS 4 .RE .IP "\fBcow\fR" 4 .IX Item "cow" User Mode Linux Copy On Write image format. Used to be the only growable image format in \s-1QEMU\s0. It is supported only for compatibility with previous versions. It does not work on win32. .IP "\fBvdi\fR" 4 .IX Item "vdi" VirtualBox 1.1 compatible image format. .IP "\fBvmdk\fR" 4 .IX Item "vmdk" VMware 3 and 4 compatible image format. .Sp Supported options: .RS 4 .ie n .IP """backing_fmt""" 4 .el .IP "\f(CWbacking_fmt\fR" 4 .IX Item "backing_fmt" Image format of the base image .ie n .IP """compat6""" 4 .el .IP "\f(CWcompat6\fR" 4 .IX Item "compat6" Create a \s-1VMDK\s0 version 6 image (instead of version 4) .RE .RS 4 .RE .IP "\fBvpc\fR" 4 .IX Item "vpc" VirtualPC compatible image format (\s-1VHD\s0). .IP "\fBcloop\fR" 4 .IX Item "cloop" Linux Compressed Loop image, useful only to reuse directly compressed CD-ROM images present for example in the Knoppix CD-ROMs. .SH "SEE ALSO" .IX Header "SEE ALSO" The \s-1HTML\s0 documentation of \s-1QEMU\s0 for more precise information and Linux user mode emulator invocation. .SH "AUTHOR" .IX Header "AUTHOR" Fabrice Bellard