Blame SOURCES/kvm-docs-add-qemu-block-drivers-7-man-page.patch

4a2fec
From 8a61770b2643a2af889205cc643d62d0ea3121f5 Mon Sep 17 00:00:00 2001
4a2fec
From: Fam Zheng <famz@redhat.com>
4a2fec
Date: Thu, 30 Nov 2017 09:25:41 +0100
4a2fec
Subject: [PATCH 04/36] docs: add qemu-block-drivers(7) man page
4a2fec
4a2fec
RH-Author: Fam Zheng <famz@redhat.com>
4a2fec
Message-id: <20171130092544.19231-3-famz@redhat.com>
4a2fec
Patchwork-id: 78014
4a2fec
O-Subject: [RHV7.5 qemu-kvm-ma PATCH 2/5] docs: add qemu-block-drivers(7) man page
4a2fec
Bugzilla: 1494210
4a2fec
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
4a2fec
RH-Acked-by: John Snow <jsnow@redhat.com>
4a2fec
4a2fec
From: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
4a2fec
Block driver documentation is available in qemu-doc.html.  It would be
4a2fec
convenient to have documentation for formats, protocols, and filter
4a2fec
drivers in a man page.
4a2fec
4a2fec
Extract the relevant part of qemu-doc.html into a new file called
4a2fec
docs/qemu-block-drivers.texi.  This file can also be built as a
4a2fec
stand-alone document (man, html, etc).
4a2fec
4a2fec
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
4a2fec
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
4a2fec
(cherry picked from commit 78aa8aa019b999ec07b62b322c1280a8250e44ac)
4a2fec
Signed-off-by: Fam Zheng <famz@redhat.com>
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
4a2fec
Conflicts:
4a2fec
	Makefile
4a2fec
Context different because we have reverted 60b412dd18362bd in downstream
4a2fec
(as e0425f69f13).
4a2fec
	qemu-doc.texi
4a2fec
We do s/qemu-system-i386/qemu-kvm/ everywhere in downstream docs.
4a2fec
---
4a2fec
 Makefile                     |   6 +-
4a2fec
 docs/qemu-block-drivers.texi | 804 +++++++++++++++++++++++++++++++++++++++++++
4a2fec
 qemu-doc.texi                | 781 +----------------------------------------
4a2fec
 3 files changed, 810 insertions(+), 781 deletions(-)
4a2fec
 create mode 100644 docs/qemu-block-drivers.texi
4a2fec
4a2fec
diff --git a/Makefile b/Makefile
4a2fec
index 312ed5e..1a773a8 100644
4a2fec
--- a/Makefile
4a2fec
+++ b/Makefile
4a2fec
@@ -209,6 +209,7 @@ ifdef BUILD_DOCS
4a2fec
 DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
4a2fec
 DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
4a2fec
 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
4a2fec
+DOCS+=docs/qemu-block-drivers.7
4a2fec
 ifdef CONFIG_LINUX
4a2fec
 DOCS+=kvm_stat.1
4a2fec
 endif
4a2fec
@@ -531,6 +532,7 @@ distclean: clean
4a2fec
 	rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
4a2fec
 	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
4a2fec
 	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
4a2fec
+	rm -f docs/qemu-block-drivers.7
4a2fec
 	for d in $(TARGET_DIRS); do \
4a2fec
 	rm -rf $$d || exit 1 ; \
4a2fec
         done
4a2fec
@@ -576,6 +578,7 @@ ifdef CONFIG_POSIX
4a2fec
 	$(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1/qemu-kvm.1"
4a2fec
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
4a2fec
 	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
4a2fec
+	$(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
4a2fec
 ifneq ($(TOOLS),)
4a2fec
 	$(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
4a2fec
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
4a2fec
@@ -725,6 +728,7 @@ qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
4a2fec
 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
4a2fec
 qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
4a2fec
 qemu-ga.8: qemu-ga.texi
4a2fec
+docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
4a2fec
 
4a2fec
 html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
4a2fec
 info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
4a2fec
@@ -739,7 +743,7 @@ kvm_stat.1: scripts/kvm/kvm_stat.texi
4a2fec
 qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
4a2fec
 	qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
4a2fec
 	qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
4a2fec
-	qemu-monitor-info.texi
4a2fec
+	qemu-monitor-info.texi docs/qemu-block-drivers.texi
4a2fec
 
4a2fec
 docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
4a2fec
     docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
4a2fec
diff --git a/docs/qemu-block-drivers.texi b/docs/qemu-block-drivers.texi
4a2fec
new file mode 100644
4a2fec
index 0000000..d3b8f3b
4a2fec
--- /dev/null
4a2fec
+++ b/docs/qemu-block-drivers.texi
4a2fec
@@ -0,0 +1,804 @@
4a2fec
+@c man begin SYNOPSIS
4a2fec
+QEMU block driver reference manual
4a2fec
+@c man end
4a2fec
+
4a2fec
+@c man begin DESCRIPTION
4a2fec
+
4a2fec
+@node disk_images_formats
4a2fec
+@subsection Disk image file formats
4a2fec
+
4a2fec
+QEMU supports many image file formats that can be used with VMs as well as with
4a2fec
+any of the tools (like @code{qemu-img}). This includes the preferred formats
4a2fec
+raw and qcow2 as well as formats that are supported for compatibility with
4a2fec
+older QEMU versions or other hypervisors.
4a2fec
+
4a2fec
+Depending on the image format, different options can be passed to
4a2fec
+@code{qemu-img create} and @code{qemu-img convert} using the @code{-o} option.
4a2fec
+This section describes each format and the options that are supported for it.
4a2fec
+
4a2fec
+@table @option
4a2fec
+@item raw
4a2fec
+
4a2fec
+Raw disk image format. This format has the advantage of
4a2fec
+being simple and easily exportable to all other emulators. If your
4a2fec
+file system supports @emph{holes} (for example in ext2 or ext3 on
4a2fec
+Linux or NTFS on Windows), then only the written sectors will reserve
4a2fec
+space. Use @code{qemu-img info} to know the real size used by the
4a2fec
+image or @code{ls -ls} on Unix/Linux.
4a2fec
+
4a2fec
+Supported options:
4a2fec
+@table @code
4a2fec
+@item preallocation
4a2fec
+Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}).
4a2fec
+@code{falloc} mode preallocates space for image by calling posix_fallocate().
4a2fec
+@code{full} mode preallocates space for image by writing zeros to underlying
4a2fec
+storage.
4a2fec
+@end table
4a2fec
+
4a2fec
+@item qcow2
4a2fec
+QEMU image format, the most versatile format. Use it to have smaller
4a2fec
+images (useful if your filesystem does not supports holes, for example
4a2fec
+on Windows), zlib based compression and support of multiple VM
4a2fec
+snapshots.
4a2fec
+
4a2fec
+Supported options:
4a2fec
+@table @code
4a2fec
+@item compat
4a2fec
+Determines the qcow2 version to use. @code{compat=0.10} uses the
4a2fec
+traditional image format that can be read by any QEMU since 0.10.
4a2fec
+@code{compat=1.1} enables image format extensions that only QEMU 1.1 and
4a2fec
+newer understand (this is the default). Amongst others, this includes
4a2fec
+zero clusters, which allow efficient copy-on-read for sparse images.
4a2fec
+
4a2fec
+@item backing_file
4a2fec
+File name of a base image (see @option{create} subcommand)
4a2fec
+@item backing_fmt
4a2fec
+Image format of the base image
4a2fec
+@item encryption
4a2fec
+This option is deprecated and equivalent to @code{encrypt.format=aes}
4a2fec
+
4a2fec
+@item encrypt.format
4a2fec
+
4a2fec
+If this is set to @code{luks}, it requests that the qcow2 payload (not
4a2fec
+qcow2 header) be encrypted using the LUKS format. The passphrase to
4a2fec
+use to unlock the LUKS key slot is given by the @code{encrypt.key-secret}
4a2fec
+parameter. LUKS encryption parameters can be tuned with the other
4a2fec
+@code{encrypt.*} parameters.
4a2fec
+
4a2fec
+If this is set to @code{aes}, the image is encrypted with 128-bit AES-CBC.
4a2fec
+The encryption key is given by the @code{encrypt.key-secret} parameter.
4a2fec
+This encryption format is considered to be flawed by modern cryptography
4a2fec
+standards, suffering from a number of design problems:
4a2fec
+
4a2fec
+@itemize @minus
4a2fec
+@item The AES-CBC cipher is used with predictable initialization vectors based
4a2fec
+on the sector number. This makes it vulnerable to chosen plaintext attacks
4a2fec
+which can reveal the existence of encrypted data.
4a2fec
+@item The user passphrase is directly used as the encryption key. A poorly
4a2fec
+chosen or short passphrase will compromise the security of the encryption.
4a2fec
+@item In the event of the passphrase being compromised there is no way to
4a2fec
+change the passphrase to protect data in any qcow images. The files must
4a2fec
+be cloned, using a different encryption passphrase in the new file. The
4a2fec
+original file must then be securely erased using a program like shred,
4a2fec
+though even this is ineffective with many modern storage technologies.
4a2fec
+@end itemize
4a2fec
+
4a2fec
+The use of this is no longer supported in system emulators. Support only
4a2fec
+remains in the command line utilities, for the purposes of data liberation
4a2fec
+and interoperability with old versions of QEMU. The @code{luks} format
4a2fec
+should be used instead.
4a2fec
+
4a2fec
+@item encrypt.key-secret
4a2fec
+
4a2fec
+Provides the ID of a @code{secret} object that contains the passphrase
4a2fec
+(@code{encrypt.format=luks}) or encryption key (@code{encrypt.format=aes}).
4a2fec
+
4a2fec
+@item encrypt.cipher-alg
4a2fec
+
4a2fec
+Name of the cipher algorithm and key length. Currently defaults
4a2fec
+to @code{aes-256}. Only used when @code{encrypt.format=luks}.
4a2fec
+
4a2fec
+@item encrypt.cipher-mode
4a2fec
+
4a2fec
+Name of the encryption mode to use. Currently defaults to @code{xts}.
4a2fec
+Only used when @code{encrypt.format=luks}.
4a2fec
+
4a2fec
+@item encrypt.ivgen-alg
4a2fec
+
4a2fec
+Name of the initialization vector generator algorithm. Currently defaults
4a2fec
+to @code{plain64}. Only used when @code{encrypt.format=luks}.
4a2fec
+
4a2fec
+@item encrypt.ivgen-hash-alg
4a2fec
+
4a2fec
+Name of the hash algorithm to use with the initialization vector generator
4a2fec
+(if required). Defaults to @code{sha256}. Only used when @code{encrypt.format=luks}.
4a2fec
+
4a2fec
+@item encrypt.hash-alg
4a2fec
+
4a2fec
+Name of the hash algorithm to use for PBKDF algorithm
4a2fec
+Defaults to @code{sha256}. Only used when @code{encrypt.format=luks}.
4a2fec
+
4a2fec
+@item encrypt.iter-time
4a2fec
+
4a2fec
+Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
4a2fec
+Defaults to @code{2000}. Only used when @code{encrypt.format=luks}.
4a2fec
+
4a2fec
+@item cluster_size
4a2fec
+Changes the qcow2 cluster size (must be between 512 and 2M). Smaller cluster
4a2fec
+sizes can improve the image file size whereas larger cluster sizes generally
4a2fec
+provide better performance.
4a2fec
+
4a2fec
+@item preallocation
4a2fec
+Preallocation mode (allowed values: @code{off}, @code{metadata}, @code{falloc},
4a2fec
+@code{full}). An image with preallocated metadata is initially larger but can
4a2fec
+improve performance when the image needs to grow. @code{falloc} and @code{full}
4a2fec
+preallocations are like the same options of @code{raw} format, but sets up
4a2fec
+metadata also.
4a2fec
+
4a2fec
+@item lazy_refcounts
4a2fec
+If this option is set to @code{on}, reference count updates are postponed with
4a2fec
+the goal of avoiding metadata I/O and improving performance. This is
4a2fec
+particularly interesting with @option{cache=writethrough} which doesn't batch
4a2fec
+metadata updates. The tradeoff is that after a host crash, the reference count
4a2fec
+tables must be rebuilt, i.e. on the next open an (automatic) @code{qemu-img
4a2fec
+check -r all} is required, which may take some time.
4a2fec
+
4a2fec
+This option can only be enabled if @code{compat=1.1} is specified.
4a2fec
+
4a2fec
+@item nocow
4a2fec
+If this option is set to @code{on}, it will turn off COW of the file. It's only
4a2fec
+valid on btrfs, no effect on other file systems.
4a2fec
+
4a2fec
+Btrfs has low performance when hosting a VM image file, even more when the guest
4a2fec
+on the VM also using btrfs as file system. Turning off COW is a way to mitigate
4a2fec
+this bad performance. Generally there are two ways to turn off COW on btrfs:
4a2fec
+a) Disable it by mounting with nodatacow, then all newly created files will be
4a2fec
+NOCOW. b) For an empty file, add the NOCOW file attribute. That's what this option
4a2fec
+does.
4a2fec
+
4a2fec
+Note: this option is only valid to new or empty files. If there is an existing
4a2fec
+file which is COW and has data blocks already, it couldn't be changed to NOCOW
4a2fec
+by setting @code{nocow=on}. One can issue @code{lsattr filename} to check if
4a2fec
+the NOCOW flag is set or not (Capital 'C' is NOCOW flag).
4a2fec
+
4a2fec
+@end table
4a2fec
+
4a2fec
+@item qed
4a2fec
+Old QEMU image format with support for backing files and compact image files
4a2fec
+(when your filesystem or transport medium does not support holes).
4a2fec
+
4a2fec
+When converting QED images to qcow2, you might want to consider using the
4a2fec
+@code{lazy_refcounts=on} option to get a more QED-like behaviour.
4a2fec
+
4a2fec
+Supported options:
4a2fec
+@table @code
4a2fec
+@item backing_file
4a2fec
+File name of a base image (see @option{create} subcommand).
4a2fec
+@item backing_fmt
4a2fec
+Image file format of backing file (optional).  Useful if the format cannot be
4a2fec
+autodetected because it has no header, like some vhd/vpc files.
4a2fec
+@item cluster_size
4a2fec
+Changes the cluster size (must be power-of-2 between 4K and 64K). Smaller
4a2fec
+cluster sizes can improve the image file size whereas larger cluster sizes
4a2fec
+generally provide better performance.
4a2fec
+@item table_size
4a2fec
+Changes the number of clusters per L1/L2 table (must be power-of-2 between 1
4a2fec
+and 16).  There is normally no need to change this value but this option can be
4a2fec
+used for performance benchmarking.
4a2fec
+@end table
4a2fec
+
4a2fec
+@item qcow
4a2fec
+Old QEMU image format with support for backing files, compact image files,
4a2fec
+encryption and compression.
4a2fec
+
4a2fec
+Supported options:
4a2fec
+@table @code
4a2fec
+@item backing_file
4a2fec
+File name of a base image (see @option{create} subcommand)
4a2fec
+@item encryption
4a2fec
+This option is deprecated and equivalent to @code{encrypt.format=aes}
4a2fec
+
4a2fec
+@item encrypt.format
4a2fec
+If this is set to @code{aes}, the image is encrypted with 128-bit AES-CBC.
4a2fec
+The encryption key is given by the @code{encrypt.key-secret} parameter.
4a2fec
+This encryption format is considered to be flawed by modern cryptography
4a2fec
+standards, suffering from a number of design problems enumerated previously
4a2fec
+against the @code{qcow2} image format.
4a2fec
+
4a2fec
+The use of this is no longer supported in system emulators. Support only
4a2fec
+remains in the command line utilities, for the purposes of data liberation
4a2fec
+and interoperability with old versions of QEMU.
4a2fec
+
4a2fec
+Users requiring native encryption should use the @code{qcow2} format
4a2fec
+instead with @code{encrypt.format=luks}.
4a2fec
+
4a2fec
+@item encrypt.key-secret
4a2fec
+
4a2fec
+Provides the ID of a @code{secret} object that contains the encryption
4a2fec
+key (@code{encrypt.format=aes}).
4a2fec
+
4a2fec
+@end table
4a2fec
+
4a2fec
+@item luks
4a2fec
+
4a2fec
+LUKS v1 encryption format, compatible with Linux dm-crypt/cryptsetup
4a2fec
+
4a2fec
+Supported options:
4a2fec
+@table @code
4a2fec
+
4a2fec
+@item key-secret
4a2fec
+
4a2fec
+Provides the ID of a @code{secret} object that contains the passphrase.
4a2fec
+
4a2fec
+@item cipher-alg
4a2fec
+
4a2fec
+Name of the cipher algorithm and key length. Currently defaults
4a2fec
+to @code{aes-256}.
4a2fec
+
4a2fec
+@item cipher-mode
4a2fec
+
4a2fec
+Name of the encryption mode to use. Currently defaults to @code{xts}.
4a2fec
+
4a2fec
+@item ivgen-alg
4a2fec
+
4a2fec
+Name of the initialization vector generator algorithm. Currently defaults
4a2fec
+to @code{plain64}.
4a2fec
+
4a2fec
+@item ivgen-hash-alg
4a2fec
+
4a2fec
+Name of the hash algorithm to use with the initialization vector generator
4a2fec
+(if required). Defaults to @code{sha256}.
4a2fec
+
4a2fec
+@item hash-alg
4a2fec
+
4a2fec
+Name of the hash algorithm to use for PBKDF algorithm
4a2fec
+Defaults to @code{sha256}.
4a2fec
+
4a2fec
+@item iter-time
4a2fec
+
4a2fec
+Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
4a2fec
+Defaults to @code{2000}.
4a2fec
+
4a2fec
+@end table
4a2fec
+
4a2fec
+@item vdi
4a2fec
+VirtualBox 1.1 compatible image format.
4a2fec
+Supported options:
4a2fec
+@table @code
4a2fec
+@item static
4a2fec
+If this option is set to @code{on}, the image is created with metadata
4a2fec
+preallocation.
4a2fec
+@end table
4a2fec
+
4a2fec
+@item vmdk
4a2fec
+VMware 3 and 4 compatible image format.
4a2fec
+
4a2fec
+Supported options:
4a2fec
+@table @code
4a2fec
+@item backing_file
4a2fec
+File name of a base image (see @option{create} subcommand).
4a2fec
+@item compat6
4a2fec
+Create a VMDK version 6 image (instead of version 4)
4a2fec
+@item hwversion
4a2fec
+Specify vmdk virtual hardware version. Compat6 flag cannot be enabled
4a2fec
+if hwversion is specified.
4a2fec
+@item subformat
4a2fec
+Specifies which VMDK subformat to use. Valid options are
4a2fec
+@code{monolithicSparse} (default),
4a2fec
+@code{monolithicFlat},
4a2fec
+@code{twoGbMaxExtentSparse},
4a2fec
+@code{twoGbMaxExtentFlat} and
4a2fec
+@code{streamOptimized}.
4a2fec
+@end table
4a2fec
+
4a2fec
+@item vpc
4a2fec
+VirtualPC compatible image format (VHD).
4a2fec
+Supported options:
4a2fec
+@table @code
4a2fec
+@item subformat
4a2fec
+Specifies which VHD subformat to use. Valid options are
4a2fec
+@code{dynamic} (default) and @code{fixed}.
4a2fec
+@end table
4a2fec
+
4a2fec
+@item VHDX
4a2fec
+Hyper-V compatible image format (VHDX).
4a2fec
+Supported options:
4a2fec
+@table @code
4a2fec
+@item subformat
4a2fec
+Specifies which VHDX subformat to use. Valid options are
4a2fec
+@code{dynamic} (default) and @code{fixed}.
4a2fec
+@item block_state_zero
4a2fec
+Force use of payload blocks of type 'ZERO'.  Can be set to @code{on} (default)
4a2fec
+or @code{off}.  When set to @code{off}, new blocks will be created as
4a2fec
+@code{PAYLOAD_BLOCK_NOT_PRESENT}, which means parsers are free to return
4a2fec
+arbitrary data for those blocks.  Do not set to @code{off} when using
4a2fec
+@code{qemu-img convert} with @code{subformat=dynamic}.
4a2fec
+@item block_size
4a2fec
+Block size; min 1 MB, max 256 MB.  0 means auto-calculate based on image size.
4a2fec
+@item log_size
4a2fec
+Log size; min 1 MB.
4a2fec
+@end table
4a2fec
+@end table
4a2fec
+
4a2fec
+@subsubsection Read-only formats
4a2fec
+More disk image file formats are supported in a read-only mode.
4a2fec
+@table @option
4a2fec
+@item bochs
4a2fec
+Bochs images of @code{growing} type.
4a2fec
+@item cloop
4a2fec
+Linux Compressed Loop image, useful only to reuse directly compressed
4a2fec
+CD-ROM images present for example in the Knoppix CD-ROMs.
4a2fec
+@item dmg
4a2fec
+Apple disk image.
4a2fec
+@item parallels
4a2fec
+Parallels disk image format.
4a2fec
+@end table
4a2fec
+
4a2fec
+
4a2fec
+@node host_drives
4a2fec
+@subsection Using host drives
4a2fec
+
4a2fec
+In addition to disk image files, QEMU can directly access host
4a2fec
+devices. We describe here the usage for QEMU version >= 0.8.3.
4a2fec
+
4a2fec
+@subsubsection Linux
4a2fec
+
4a2fec
+On Linux, you can directly use the host device filename instead of a
4a2fec
+disk image filename provided you have enough privileges to access
4a2fec
+it. For example, use @file{/dev/cdrom} to access to the CDROM.
4a2fec
+
4a2fec
+@table @code
4a2fec
+@item CD
4a2fec
+You can specify a CDROM device even if no CDROM is loaded. QEMU has
4a2fec
+specific code to detect CDROM insertion or removal. CDROM ejection by
4a2fec
+the guest OS is supported. Currently only data CDs are supported.
4a2fec
+@item Floppy
4a2fec
+You can specify a floppy device even if no floppy is loaded. Floppy
4a2fec
+removal is currently not detected accurately (if you change floppy
4a2fec
+without doing floppy access while the floppy is not loaded, the guest
4a2fec
+OS will think that the same floppy is loaded).
4a2fec
+Use of the host's floppy device is deprecated, and support for it will
4a2fec
+be removed in a future release.
4a2fec
+@item Hard disks
4a2fec
+Hard disks can be used. Normally you must specify the whole disk
4a2fec
+(@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can
4a2fec
+see it as a partitioned disk. WARNING: unless you know what you do, it
4a2fec
+is better to only make READ-ONLY accesses to the hard disk otherwise
4a2fec
+you may corrupt your host data (use the @option{-snapshot} command
4a2fec
+line option or modify the device permissions accordingly).
4a2fec
+@end table
4a2fec
+
4a2fec
+@subsubsection Windows
4a2fec
+
4a2fec
+@table @code
4a2fec
+@item CD
4a2fec
+The preferred syntax is the drive letter (e.g. @file{d:}). The
4a2fec
+alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is
4a2fec
+supported as an alias to the first CDROM drive.
4a2fec
+
4a2fec
+Currently there is no specific code to handle removable media, so it
4a2fec
+is better to use the @code{change} or @code{eject} monitor commands to
4a2fec
+change or eject media.
4a2fec
+@item Hard disks
4a2fec
+Hard disks can be used with the syntax: @file{\\.\PhysicalDrive@var{N}}
4a2fec
+where @var{N} is the drive number (0 is the first hard disk).
4a2fec
+
4a2fec
+WARNING: unless you know what you do, it is better to only make
4a2fec
+READ-ONLY accesses to the hard disk otherwise you may corrupt your
4a2fec
+host data (use the @option{-snapshot} command line so that the
4a2fec
+modifications are written in a temporary file).
4a2fec
+@end table
4a2fec
+
4a2fec
+
4a2fec
+@subsubsection Mac OS X
4a2fec
+
4a2fec
+@file{/dev/cdrom} is an alias to the first CDROM.
4a2fec
+
4a2fec
+Currently there is no specific code to handle removable media, so it
4a2fec
+is better to use the @code{change} or @code{eject} monitor commands to
4a2fec
+change or eject media.
4a2fec
+
4a2fec
+@node disk_images_fat_images
4a2fec
+@subsection Virtual FAT disk images
4a2fec
+
4a2fec
+QEMU can automatically create a virtual FAT disk image from a
4a2fec
+directory tree. In order to use it, just type:
4a2fec
+
4a2fec
+@example
4a2fec
+qemu-kvm linux.img -hdb fat:/my_directory
4a2fec
+@end example
4a2fec
+
4a2fec
+Then you access access to all the files in the @file{/my_directory}
4a2fec
+directory without having to copy them in a disk image or to export
4a2fec
+them via SAMBA or NFS. The default access is @emph{read-only}.
4a2fec
+
4a2fec
+Floppies can be emulated with the @code{:floppy:} option:
4a2fec
+
4a2fec
+@example
4a2fec
+qemu-kvm linux.img -fda fat:floppy:/my_directory
4a2fec
+@end example
4a2fec
+
4a2fec
+A read/write support is available for testing (beta stage) with the
4a2fec
+@code{:rw:} option:
4a2fec
+
4a2fec
+@example
4a2fec
+qemu-kvm linux.img -fda fat:floppy:rw:/my_directory
4a2fec
+@end example
4a2fec
+
4a2fec
+What you should @emph{never} do:
4a2fec
+@itemize
4a2fec
+@item use non-ASCII filenames ;
4a2fec
+@item use "-snapshot" together with ":rw:" ;
4a2fec
+@item expect it to work when loadvm'ing ;
4a2fec
+@item write to the FAT directory on the host system while accessing it with the guest system.
4a2fec
+@end itemize
4a2fec
+
4a2fec
+@node disk_images_nbd
4a2fec
+@subsection NBD access
4a2fec
+
4a2fec
+QEMU can access directly to block device exported using the Network Block Device
4a2fec
+protocol.
4a2fec
+
4a2fec
+@example
4a2fec
+qemu-kvm linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/
4a2fec
+@end example
4a2fec
+
4a2fec
+If the NBD server is located on the same host, you can use an unix socket instead
4a2fec
+of an inet socket:
4a2fec
+
4a2fec
+@example
4a2fec
+qemu-kvm linux.img -hdb nbd+unix://?socket=/tmp/my_socket
4a2fec
+@end example
4a2fec
+
4a2fec
+In this case, the block device must be exported using qemu-nbd:
4a2fec
+
4a2fec
+@example
4a2fec
+qemu-nbd --socket=/tmp/my_socket my_disk.qcow2
4a2fec
+@end example
4a2fec
+
4a2fec
+The use of qemu-nbd allows sharing of a disk between several guests:
4a2fec
+@example
4a2fec
+qemu-nbd --socket=/tmp/my_socket --share=2 my_disk.qcow2
4a2fec
+@end example
4a2fec
+
4a2fec
+@noindent
4a2fec
+and then you can use it with two guests:
4a2fec
+@example
4a2fec
+qemu-kvm linux1.img -hdb nbd+unix://?socket=/tmp/my_socket
4a2fec
+qemu-kvm linux2.img -hdb nbd+unix://?socket=/tmp/my_socket
4a2fec
+@end example
4a2fec
+
4a2fec
+If the nbd-server uses named exports (supported since NBD 2.9.18, or with QEMU's
4a2fec
+own embedded NBD server), you must specify an export name in the URI:
4a2fec
+@example
4a2fec
+qemu-kvm -cdrom nbd://localhost/debian-500-ppc-netinst
4a2fec
+qemu-kvm -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst
4a2fec
+@end example
4a2fec
+
4a2fec
+The URI syntax for NBD is supported since QEMU 1.3.  An alternative syntax is
4a2fec
+also available.  Here are some example of the older syntax:
4a2fec
+@example
4a2fec
+qemu-kvm linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
4a2fec
+qemu-kvm linux2.img -hdb nbd:unix:/tmp/my_socket
4a2fec
+qemu-kvm -cdrom nbd:localhost:10809:exportname=debian-500-ppc-netinst
4a2fec
+@end example
4a2fec
+
4a2fec
+@node disk_images_sheepdog
4a2fec
+@subsection Sheepdog disk images
4a2fec
+
4a2fec
+Sheepdog is a distributed storage system for QEMU.  It provides highly
4a2fec
+available block level storage volumes that can be attached to
4a2fec
+QEMU-based virtual machines.
4a2fec
+
4a2fec
+You can create a Sheepdog disk image with the command:
4a2fec
+@example
4a2fec
+qemu-img create sheepdog:///@var{image} @var{size}
4a2fec
+@end example
4a2fec
+where @var{image} is the Sheepdog image name and @var{size} is its
4a2fec
+size.
4a2fec
+
4a2fec
+To import the existing @var{filename} to Sheepdog, you can use a
4a2fec
+convert command.
4a2fec
+@example
4a2fec
+qemu-img convert @var{filename} sheepdog:///@var{image}
4a2fec
+@end example
4a2fec
+
4a2fec
+You can boot from the Sheepdog disk image with the command:
4a2fec
+@example
4a2fec
+qemu-kvm sheepdog:///@var{image}
4a2fec
+@end example
4a2fec
+
4a2fec
+You can also create a snapshot of the Sheepdog image like qcow2.
4a2fec
+@example
4a2fec
+qemu-img snapshot -c @var{tag} sheepdog:///@var{image}
4a2fec
+@end example
4a2fec
+where @var{tag} is a tag name of the newly created snapshot.
4a2fec
+
4a2fec
+To boot from the Sheepdog snapshot, specify the tag name of the
4a2fec
+snapshot.
4a2fec
+@example
4a2fec
+qemu-kvm sheepdog:///@var{image}#@var{tag}
4a2fec
+@end example
4a2fec
+
4a2fec
+You can create a cloned image from the existing snapshot.
4a2fec
+@example
4a2fec
+qemu-img create -b sheepdog:///@var{base}#@var{tag} sheepdog:///@var{image}
4a2fec
+@end example
4a2fec
+where @var{base} is a image name of the source snapshot and @var{tag}
4a2fec
+is its tag name.
4a2fec
+
4a2fec
+You can use an unix socket instead of an inet socket:
4a2fec
+
4a2fec
+@example
4a2fec
+qemu-kvm sheepdog+unix:///@var{image}?socket=@var{path}
4a2fec
+@end example
4a2fec
+
4a2fec
+If the Sheepdog daemon doesn't run on the local host, you need to
4a2fec
+specify one of the Sheepdog servers to connect to.
4a2fec
+@example
4a2fec
+qemu-img create sheepdog://@var{hostname}:@var{port}/@var{image} @var{size}
4a2fec
+qemu-kvm sheepdog://@var{hostname}:@var{port}/@var{image}
4a2fec
+@end example
4a2fec
+
4a2fec
+@node disk_images_iscsi
4a2fec
+@subsection iSCSI LUNs
4a2fec
+
4a2fec
+iSCSI is a popular protocol used to access SCSI devices across a computer
4a2fec
+network.
4a2fec
+
4a2fec
+There are two different ways iSCSI devices can be used by QEMU.
4a2fec
+
4a2fec
+The first method is to mount the iSCSI LUN on the host, and make it appear as
4a2fec
+any other ordinary SCSI device on the host and then to access this device as a
4a2fec
+/dev/sd device from QEMU. How to do this differs between host OSes.
4a2fec
+
4a2fec
+The second method involves using the iSCSI initiator that is built into
4a2fec
+QEMU. This provides a mechanism that works the same way regardless of which
4a2fec
+host OS you are running QEMU on. This section will describe this second method
4a2fec
+of using iSCSI together with QEMU.
4a2fec
+
4a2fec
+In QEMU, iSCSI devices are described using special iSCSI URLs
4a2fec
+
4a2fec
+@example
4a2fec
+URL syntax:
4a2fec
+iscsi://[<username>[%<password>]@@]<host>[:<port>]/<target-iqn-name>/<lun>
4a2fec
+@end example
4a2fec
+
4a2fec
+Username and password are optional and only used if your target is set up
4a2fec
+using CHAP authentication for access control.
4a2fec
+Alternatively the username and password can also be set via environment
4a2fec
+variables to have these not show up in the process list
4a2fec
+
4a2fec
+@example
4a2fec
+export LIBISCSI_CHAP_USERNAME=<username>
4a2fec
+export LIBISCSI_CHAP_PASSWORD=<password>
4a2fec
+iscsi://<host>/<target-iqn-name>/<lun>
4a2fec
+@end example
4a2fec
+
4a2fec
+Various session related parameters can be set via special options, either
4a2fec
+in a configuration file provided via '-readconfig' or directly on the
4a2fec
+command line.
4a2fec
+
4a2fec
+If the initiator-name is not specified qemu will use a default name
4a2fec
+of 'iqn.2008-11.org.linux-kvm[:<uuid>'] where <uuid> is the UUID of the
4a2fec
+virtual machine. If the UUID is not specified qemu will use
4a2fec
+'iqn.2008-11.org.linux-kvm[:<name>'] where <name> is the name of the
4a2fec
+virtual machine.
4a2fec
+
4a2fec
+@example
4a2fec
+Setting a specific initiator name to use when logging in to the target
4a2fec
+-iscsi initiator-name=iqn.qemu.test:my-initiator
4a2fec
+@end example
4a2fec
+
4a2fec
+@example
4a2fec
+Controlling which type of header digest to negotiate with the target
4a2fec
+-iscsi header-digest=CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
4a2fec
+@end example
4a2fec
+
4a2fec
+These can also be set via a configuration file
4a2fec
+@example
4a2fec
+[iscsi]
4a2fec
+  user = "CHAP username"
4a2fec
+  password = "CHAP password"
4a2fec
+  initiator-name = "iqn.qemu.test:my-initiator"
4a2fec
+  # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
4a2fec
+  header-digest = "CRC32C"
4a2fec
+@end example
4a2fec
+
4a2fec
+
4a2fec
+Setting the target name allows different options for different targets
4a2fec
+@example
4a2fec
+[iscsi "iqn.target.name"]
4a2fec
+  user = "CHAP username"
4a2fec
+  password = "CHAP password"
4a2fec
+  initiator-name = "iqn.qemu.test:my-initiator"
4a2fec
+  # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
4a2fec
+  header-digest = "CRC32C"
4a2fec
+@end example
4a2fec
+
4a2fec
+
4a2fec
+Howto use a configuration file to set iSCSI configuration options:
4a2fec
+@example
4a2fec
+cat >iscsi.conf <
4a2fec
+[iscsi]
4a2fec
+  user = "me"
4a2fec
+  password = "my password"
4a2fec
+  initiator-name = "iqn.qemu.test:my-initiator"
4a2fec
+  header-digest = "CRC32C"
4a2fec
+EOF
4a2fec
+
4a2fec
+qemu-kvm -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
4a2fec
+    -readconfig iscsi.conf
4a2fec
+@end example
4a2fec
+
4a2fec
+
4a2fec
+Howto set up a simple iSCSI target on loopback and accessing it via QEMU:
4a2fec
+@example
4a2fec
+This example shows how to set up an iSCSI target with one CDROM and one DISK
4a2fec
+using the Linux STGT software target. This target is available on Red Hat based
4a2fec
+systems as the package 'scsi-target-utils'.
4a2fec
+
4a2fec
+tgtd --iscsi portal=127.0.0.1:3260
4a2fec
+tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
4a2fec
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \
4a2fec
+    -b /IMAGES/disk.img --device-type=disk
4a2fec
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
4a2fec
+    -b /IMAGES/cd.iso --device-type=cd
4a2fec
+tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
4a2fec
+
4a2fec
+qemu-kvm -iscsi initiator-name=iqn.qemu.test:my-initiator \
4a2fec
+    -boot d -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
4a2fec
+    -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
4a2fec
+@end example
4a2fec
+
4a2fec
+@node disk_images_gluster
4a2fec
+@subsection GlusterFS disk images
4a2fec
+
4a2fec
+GlusterFS is a user space distributed file system.
4a2fec
+
4a2fec
+You can boot from the GlusterFS disk image with the command:
4a2fec
+@example
4a2fec
+URI:
4a2fec
+qemu-system-x86_64 -drive file=gluster[+@var{type}]://[@var{host}[:@var{port}]]/@var{volume}/@var{path}
4a2fec
+                               [?socket=...][,file.debug=9][,file.logfile=...]
4a2fec
+
4a2fec
+JSON:
4a2fec
+qemu-system-x86_64 'json:@{"driver":"qcow2",
4a2fec
+                           "file":@{"driver":"gluster",
4a2fec
+                                    "volume":"testvol","path":"a.img","debug":9,"logfile":"...",
4a2fec
+                                    "server":[@{"type":"tcp","host":"...","port":"..."@},
4a2fec
+                                              @{"type":"unix","socket":"..."@}]@}@}'
4a2fec
+@end example
4a2fec
+
4a2fec
+@var{gluster} is the protocol.
4a2fec
+
4a2fec
+@var{type} specifies the transport type used to connect to gluster
4a2fec
+management daemon (glusterd). Valid transport types are
4a2fec
+tcp and unix. In the URI form, if a transport type isn't specified,
4a2fec
+then tcp type is assumed.
4a2fec
+
4a2fec
+@var{host} specifies the server where the volume file specification for
4a2fec
+the given volume resides. This can be either a hostname or an ipv4 address.
4a2fec
+If transport type is unix, then @var{host} field should not be specified.
4a2fec
+Instead @var{socket} field needs to be populated with the path to unix domain
4a2fec
+socket.
4a2fec
+
4a2fec
+@var{port} is the port number on which glusterd is listening. This is optional
4a2fec
+and if not specified, it defaults to port 24007. If the transport type is unix,
4a2fec
+then @var{port} should not be specified.
4a2fec
+
4a2fec
+@var{volume} is the name of the gluster volume which contains the disk image.
4a2fec
+
4a2fec
+@var{path} is the path to the actual disk image that resides on gluster volume.
4a2fec
+
4a2fec
+@var{debug} is the logging level of the gluster protocol driver. Debug levels
4a2fec
+are 0-9, with 9 being the most verbose, and 0 representing no debugging output.
4a2fec
+The default level is 4. The current logging levels defined in the gluster source
4a2fec
+are 0 - None, 1 - Emergency, 2 - Alert, 3 - Critical, 4 - Error, 5 - Warning,
4a2fec
+6 - Notice, 7 - Info, 8 - Debug, 9 - Trace
4a2fec
+
4a2fec
+@var{logfile} is a commandline option to mention log file path which helps in
4a2fec
+logging to the specified file and also help in persisting the gfapi logs. The
4a2fec
+default is stderr.
4a2fec
+
4a2fec
+
4a2fec
+
4a2fec
+
4a2fec
+You can create a GlusterFS disk image with the command:
4a2fec
+@example
4a2fec
+qemu-img create gluster://@var{host}/@var{volume}/@var{path} @var{size}
4a2fec
+@end example
4a2fec
+
4a2fec
+Examples
4a2fec
+@example
4a2fec
+qemu-system-x86_64 -drive file=gluster://1.2.3.4/testvol/a.img
4a2fec
+qemu-system-x86_64 -drive file=gluster+tcp://1.2.3.4/testvol/a.img
4a2fec
+qemu-system-x86_64 -drive file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
4a2fec
+qemu-system-x86_64 -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img
4a2fec
+qemu-system-x86_64 -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img
4a2fec
+qemu-system-x86_64 -drive file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img
4a2fec
+qemu-system-x86_64 -drive file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket
4a2fec
+qemu-system-x86_64 -drive file=gluster+rdma://1.2.3.4:24007/testvol/a.img
4a2fec
+qemu-system-x86_64 -drive file=gluster://1.2.3.4/testvol/a.img,file.debug=9,file.logfile=/var/log/qemu-gluster.log
4a2fec
+qemu-system-x86_64 'json:@{"driver":"qcow2",
4a2fec
+                           "file":@{"driver":"gluster",
4a2fec
+                                    "volume":"testvol","path":"a.img",
4a2fec
+                                    "debug":9,"logfile":"/var/log/qemu-gluster.log",
4a2fec
+                                    "server":[@{"type":"tcp","host":"1.2.3.4","port":24007@},
4a2fec
+                                              @{"type":"unix","socket":"/var/run/glusterd.socket"@}]@}@}'
4a2fec
+qemu-system-x86_64 -drive driver=qcow2,file.driver=gluster,file.volume=testvol,file.path=/path/a.img,
4a2fec
+                                       file.debug=9,file.logfile=/var/log/qemu-gluster.log,
4a2fec
+                                       file.server.0.type=tcp,file.server.0.host=1.2.3.4,file.server.0.port=24007,
4a2fec
+                                       file.server.1.type=unix,file.server.1.socket=/var/run/glusterd.socket
4a2fec
+@end example
4a2fec
+
4a2fec
+@node disk_images_ssh
4a2fec
+@subsection Secure Shell (ssh) disk images
4a2fec
+
4a2fec
+You can access disk images located on a remote ssh server
4a2fec
+by using the ssh protocol:
4a2fec
+
4a2fec
+@example
4a2fec
+qemu-system-x86_64 -drive file=ssh://[@var{user}@@]@var{server}[:@var{port}]/@var{path}[?host_key_check=@var{host_key_check}]
4a2fec
+@end example
4a2fec
+
4a2fec
+Alternative syntax using properties:
4a2fec
+
4a2fec
+@example
4a2fec
+qemu-system-x86_64 -drive file.driver=ssh[,file.user=@var{user}],file.host=@var{server}[,file.port=@var{port}],file.path=@var{path}[,file.host_key_check=@var{host_key_check}]
4a2fec
+@end example
4a2fec
+
4a2fec
+@var{ssh} is the protocol.
4a2fec
+
4a2fec
+@var{user} is the remote user.  If not specified, then the local
4a2fec
+username is tried.
4a2fec
+
4a2fec
+@var{server} specifies the remote ssh server.  Any ssh server can be
4a2fec
+used, but it must implement the sftp-server protocol.  Most Unix/Linux
4a2fec
+systems should work without requiring any extra configuration.
4a2fec
+
4a2fec
+@var{port} is the port number on which sshd is listening.  By default
4a2fec
+the standard ssh port (22) is used.
4a2fec
+
4a2fec
+@var{path} is the path to the disk image.
4a2fec
+
4a2fec
+The optional @var{host_key_check} parameter controls how the remote
4a2fec
+host's key is checked.  The default is @code{yes} which means to use
4a2fec
+the local @file{.ssh/known_hosts} file.  Setting this to @code{no}
4a2fec
+turns off known-hosts checking.  Or you can check that the host key
4a2fec
+matches a specific fingerprint:
4a2fec
+@code{host_key_check=md5:78:45:8e:14:57:4f:d5:45:83:0a:0e:f3:49:82:c9:c8}
4a2fec
+(@code{sha1:} can also be used as a prefix, but note that OpenSSH
4a2fec
+tools only use MD5 to print fingerprints).
4a2fec
+
4a2fec
+Currently authentication must be done using ssh-agent.  Other
4a2fec
+authentication methods may be supported in future.
4a2fec
+
4a2fec
+Note: Many ssh servers do not support an @code{fsync}-style operation.
4a2fec
+The ssh driver cannot guarantee that disk flush requests are
4a2fec
+obeyed, and this causes a risk of disk corruption if the remote
4a2fec
+server or network goes down during writes.  The driver will
4a2fec
+print a warning when @code{fsync} is not supported:
4a2fec
+
4a2fec
+warning: ssh server @code{ssh.example.com:22} does not support fsync
4a2fec
+
4a2fec
+With sufficiently new versions of libssh2 and OpenSSH, @code{fsync} is
4a2fec
+supported.
4a2fec
+
4a2fec
+@c man end
4a2fec
+
4a2fec
+@ignore
4a2fec
+
4a2fec
+@setfilename qemu-block-drivers
4a2fec
+@settitle QEMU block drivers reference
4a2fec
+
4a2fec
+@c man begin SEEALSO
4a2fec
+The HTML documentation of QEMU for more precise information and Linux
4a2fec
+user mode emulator invocation.
4a2fec
+@c man end
4a2fec
+
4a2fec
+@c man begin AUTHOR
4a2fec
+Fabrice Bellard and the QEMU Project developers
4a2fec
+@c man end
4a2fec
+
4a2fec
+@end ignore
4a2fec
diff --git a/qemu-doc.texi b/qemu-doc.texi
4a2fec
index db09b7e..b0db386 100644
4a2fec
--- a/qemu-doc.texi
4a2fec
+++ b/qemu-doc.texi
4a2fec
@@ -490,786 +490,7 @@ state is not saved or restored properly (in particular USB).
4a2fec
 
4a2fec
 @include qemu-nbd.texi
4a2fec
 
4a2fec
-@node disk_images_formats
4a2fec
-@subsection Disk image file formats
4a2fec
-
4a2fec
-QEMU supports many image file formats that can be used with VMs as well as with
4a2fec
-any of the tools (like @code{qemu-img}). This includes the preferred formats
4a2fec
-raw and qcow2 as well as formats that are supported for compatibility with
4a2fec
-older QEMU versions or other hypervisors.
4a2fec
-
4a2fec
-Depending on the image format, different options can be passed to
4a2fec
-@code{qemu-img create} and @code{qemu-img convert} using the @code{-o} option.
4a2fec
-This section describes each format and the options that are supported for it.
4a2fec
-
4a2fec
-@table @option
4a2fec
-@item raw
4a2fec
-
4a2fec
-Raw disk image format. This format has the advantage of
4a2fec
-being simple and easily exportable to all other emulators. If your
4a2fec
-file system supports @emph{holes} (for example in ext2 or ext3 on
4a2fec
-Linux or NTFS on Windows), then only the written sectors will reserve
4a2fec
-space. Use @code{qemu-img info} to know the real size used by the
4a2fec
-image or @code{ls -ls} on Unix/Linux.
4a2fec
-
4a2fec
-Supported options:
4a2fec
-@table @code
4a2fec
-@item preallocation
4a2fec
-Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}).
4a2fec
-@code{falloc} mode preallocates space for image by calling posix_fallocate().
4a2fec
-@code{full} mode preallocates space for image by writing zeros to underlying
4a2fec
-storage.
4a2fec
-@end table
4a2fec
-
4a2fec
-@item qcow2
4a2fec
-QEMU image format, the most versatile format. Use it to have smaller
4a2fec
-images (useful if your filesystem does not supports holes, for example
4a2fec
-on Windows), zlib based compression and support of multiple VM
4a2fec
-snapshots.
4a2fec
-
4a2fec
-Supported options:
4a2fec
-@table @code
4a2fec
-@item compat
4a2fec
-Determines the qcow2 version to use. @code{compat=0.10} uses the
4a2fec
-traditional image format that can be read by any QEMU since 0.10.
4a2fec
-@code{compat=1.1} enables image format extensions that only QEMU 1.1 and
4a2fec
-newer understand (this is the default). Amongst others, this includes
4a2fec
-zero clusters, which allow efficient copy-on-read for sparse images.
4a2fec
-
4a2fec
-@item backing_file
4a2fec
-File name of a base image (see @option{create} subcommand)
4a2fec
-@item backing_fmt
4a2fec
-Image format of the base image
4a2fec
-@item encryption
4a2fec
-This option is deprecated and equivalent to @code{encrypt.format=aes}
4a2fec
-
4a2fec
-@item encrypt.format
4a2fec
-
4a2fec
-If this is set to @code{luks}, it requests that the qcow2 payload (not
4a2fec
-qcow2 header) be encrypted using the LUKS format. The passphrase to
4a2fec
-use to unlock the LUKS key slot is given by the @code{encrypt.key-secret}
4a2fec
-parameter. LUKS encryption parameters can be tuned with the other
4a2fec
-@code{encrypt.*} parameters.
4a2fec
-
4a2fec
-If this is set to @code{aes}, the image is encrypted with 128-bit AES-CBC.
4a2fec
-The encryption key is given by the @code{encrypt.key-secret} parameter.
4a2fec
-This encryption format is considered to be flawed by modern cryptography
4a2fec
-standards, suffering from a number of design problems:
4a2fec
-
4a2fec
-@itemize @minus
4a2fec
-@item The AES-CBC cipher is used with predictable initialization vectors based
4a2fec
-on the sector number. This makes it vulnerable to chosen plaintext attacks
4a2fec
-which can reveal the existence of encrypted data.
4a2fec
-@item The user passphrase is directly used as the encryption key. A poorly
4a2fec
-chosen or short passphrase will compromise the security of the encryption.
4a2fec
-@item In the event of the passphrase being compromised there is no way to
4a2fec
-change the passphrase to protect data in any qcow images. The files must
4a2fec
-be cloned, using a different encryption passphrase in the new file. The
4a2fec
-original file must then be securely erased using a program like shred,
4a2fec
-though even this is ineffective with many modern storage technologies.
4a2fec
-@end itemize
4a2fec
-
4a2fec
-The use of this is no longer supported in system emulators. Support only
4a2fec
-remains in the command line utilities, for the purposes of data liberation
4a2fec
-and interoperability with old versions of QEMU. The @code{luks} format
4a2fec
-should be used instead.
4a2fec
-
4a2fec
-@item encrypt.key-secret
4a2fec
-
4a2fec
-Provides the ID of a @code{secret} object that contains the passphrase
4a2fec
-(@code{encrypt.format=luks}) or encryption key (@code{encrypt.format=aes}).
4a2fec
-
4a2fec
-@item encrypt.cipher-alg
4a2fec
-
4a2fec
-Name of the cipher algorithm and key length. Currently defaults
4a2fec
-to @code{aes-256}. Only used when @code{encrypt.format=luks}.
4a2fec
-
4a2fec
-@item encrypt.cipher-mode
4a2fec
-
4a2fec
-Name of the encryption mode to use. Currently defaults to @code{xts}.
4a2fec
-Only used when @code{encrypt.format=luks}.
4a2fec
-
4a2fec
-@item encrypt.ivgen-alg
4a2fec
-
4a2fec
-Name of the initialization vector generator algorithm. Currently defaults
4a2fec
-to @code{plain64}. Only used when @code{encrypt.format=luks}.
4a2fec
-
4a2fec
-@item encrypt.ivgen-hash-alg
4a2fec
-
4a2fec
-Name of the hash algorithm to use with the initialization vector generator
4a2fec
-(if required). Defaults to @code{sha256}. Only used when @code{encrypt.format=luks}.
4a2fec
-
4a2fec
-@item encrypt.hash-alg
4a2fec
-
4a2fec
-Name of the hash algorithm to use for PBKDF algorithm
4a2fec
-Defaults to @code{sha256}. Only used when @code{encrypt.format=luks}.
4a2fec
-
4a2fec
-@item encrypt.iter-time
4a2fec
-
4a2fec
-Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
4a2fec
-Defaults to @code{2000}. Only used when @code{encrypt.format=luks}.
4a2fec
-
4a2fec
-@item cluster_size
4a2fec
-Changes the qcow2 cluster size (must be between 512 and 2M). Smaller cluster
4a2fec
-sizes can improve the image file size whereas larger cluster sizes generally
4a2fec
-provide better performance.
4a2fec
-
4a2fec
-@item preallocation
4a2fec
-Preallocation mode (allowed values: @code{off}, @code{metadata}, @code{falloc},
4a2fec
-@code{full}). An image with preallocated metadata is initially larger but can
4a2fec
-improve performance when the image needs to grow. @code{falloc} and @code{full}
4a2fec
-preallocations are like the same options of @code{raw} format, but sets up
4a2fec
-metadata also.
4a2fec
-
4a2fec
-@item lazy_refcounts
4a2fec
-If this option is set to @code{on}, reference count updates are postponed with
4a2fec
-the goal of avoiding metadata I/O and improving performance. This is
4a2fec
-particularly interesting with @option{cache=writethrough} which doesn't batch
4a2fec
-metadata updates. The tradeoff is that after a host crash, the reference count
4a2fec
-tables must be rebuilt, i.e. on the next open an (automatic) @code{qemu-img
4a2fec
-check -r all} is required, which may take some time.
4a2fec
-
4a2fec
-This option can only be enabled if @code{compat=1.1} is specified.
4a2fec
-
4a2fec
-@item nocow
4a2fec
-If this option is set to @code{on}, it will turn off COW of the file. It's only
4a2fec
-valid on btrfs, no effect on other file systems.
4a2fec
-
4a2fec
-Btrfs has low performance when hosting a VM image file, even more when the guest
4a2fec
-on the VM also using btrfs as file system. Turning off COW is a way to mitigate
4a2fec
-this bad performance. Generally there are two ways to turn off COW on btrfs:
4a2fec
-a) Disable it by mounting with nodatacow, then all newly created files will be
4a2fec
-NOCOW. b) For an empty file, add the NOCOW file attribute. That's what this option
4a2fec
-does.
4a2fec
-
4a2fec
-Note: this option is only valid to new or empty files. If there is an existing
4a2fec
-file which is COW and has data blocks already, it couldn't be changed to NOCOW
4a2fec
-by setting @code{nocow=on}. One can issue @code{lsattr filename} to check if
4a2fec
-the NOCOW flag is set or not (Capital 'C' is NOCOW flag).
4a2fec
-
4a2fec
-@end table
4a2fec
-
4a2fec
-@item qed
4a2fec
-Old QEMU image format with support for backing files and compact image files
4a2fec
-(when your filesystem or transport medium does not support holes).
4a2fec
-
4a2fec
-When converting QED images to qcow2, you might want to consider using the
4a2fec
-@code{lazy_refcounts=on} option to get a more QED-like behaviour.
4a2fec
-
4a2fec
-Supported options:
4a2fec
-@table @code
4a2fec
-@item backing_file
4a2fec
-File name of a base image (see @option{create} subcommand).
4a2fec
-@item backing_fmt
4a2fec
-Image file format of backing file (optional).  Useful if the format cannot be
4a2fec
-autodetected because it has no header, like some vhd/vpc files.
4a2fec
-@item cluster_size
4a2fec
-Changes the cluster size (must be power-of-2 between 4K and 64K). Smaller
4a2fec
-cluster sizes can improve the image file size whereas larger cluster sizes
4a2fec
-generally provide better performance.
4a2fec
-@item table_size
4a2fec
-Changes the number of clusters per L1/L2 table (must be power-of-2 between 1
4a2fec
-and 16).  There is normally no need to change this value but this option can be
4a2fec
-used for performance benchmarking.
4a2fec
-@end table
4a2fec
-
4a2fec
-@item qcow
4a2fec
-Old QEMU image format with support for backing files, compact image files,
4a2fec
-encryption and compression.
4a2fec
-
4a2fec
-Supported options:
4a2fec
-@table @code
4a2fec
-@item backing_file
4a2fec
-File name of a base image (see @option{create} subcommand)
4a2fec
-@item encryption
4a2fec
-This option is deprecated and equivalent to @code{encrypt.format=aes}
4a2fec
-
4a2fec
-@item encrypt.format
4a2fec
-If this is set to @code{aes}, the image is encrypted with 128-bit AES-CBC.
4a2fec
-The encryption key is given by the @code{encrypt.key-secret} parameter.
4a2fec
-This encryption format is considered to be flawed by modern cryptography
4a2fec
-standards, suffering from a number of design problems enumerated previously
4a2fec
-against the @code{qcow2} image format.
4a2fec
-
4a2fec
-The use of this is no longer supported in system emulators. Support only
4a2fec
-remains in the command line utilities, for the purposes of data liberation
4a2fec
-and interoperability with old versions of QEMU.
4a2fec
-
4a2fec
-Users requiring native encryption should use the @code{qcow2} format
4a2fec
-instead with @code{encrypt.format=luks}.
4a2fec
-
4a2fec
-@item encrypt.key-secret
4a2fec
-
4a2fec
-Provides the ID of a @code{secret} object that contains the encryption
4a2fec
-key (@code{encrypt.format=aes}).
4a2fec
-
4a2fec
-@end table
4a2fec
-
4a2fec
-@item luks
4a2fec
-
4a2fec
-LUKS v1 encryption format, compatible with Linux dm-crypt/cryptsetup
4a2fec
-
4a2fec
-Supported options:
4a2fec
-@table @code
4a2fec
-
4a2fec
-@item key-secret
4a2fec
-
4a2fec
-Provides the ID of a @code{secret} object that contains the passphrase.
4a2fec
-
4a2fec
-@item cipher-alg
4a2fec
-
4a2fec
-Name of the cipher algorithm and key length. Currently defaults
4a2fec
-to @code{aes-256}.
4a2fec
-
4a2fec
-@item cipher-mode
4a2fec
-
4a2fec
-Name of the encryption mode to use. Currently defaults to @code{xts}.
4a2fec
-
4a2fec
-@item ivgen-alg
4a2fec
-
4a2fec
-Name of the initialization vector generator algorithm. Currently defaults
4a2fec
-to @code{plain64}.
4a2fec
-
4a2fec
-@item ivgen-hash-alg
4a2fec
-
4a2fec
-Name of the hash algorithm to use with the initialization vector generator
4a2fec
-(if required). Defaults to @code{sha256}.
4a2fec
-
4a2fec
-@item hash-alg
4a2fec
-
4a2fec
-Name of the hash algorithm to use for PBKDF algorithm
4a2fec
-Defaults to @code{sha256}.
4a2fec
-
4a2fec
-@item iter-time
4a2fec
-
4a2fec
-Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
4a2fec
-Defaults to @code{2000}.
4a2fec
-
4a2fec
-@end table
4a2fec
-
4a2fec
-@item vdi
4a2fec
-VirtualBox 1.1 compatible image format.
4a2fec
-Supported options:
4a2fec
-@table @code
4a2fec
-@item static
4a2fec
-If this option is set to @code{on}, the image is created with metadata
4a2fec
-preallocation.
4a2fec
-@end table
4a2fec
-
4a2fec
-@item vmdk
4a2fec
-VMware 3 and 4 compatible image format.
4a2fec
-
4a2fec
-Supported options:
4a2fec
-@table @code
4a2fec
-@item backing_file
4a2fec
-File name of a base image (see @option{create} subcommand).
4a2fec
-@item compat6
4a2fec
-Create a VMDK version 6 image (instead of version 4)
4a2fec
-@item hwversion
4a2fec
-Specify vmdk virtual hardware version. Compat6 flag cannot be enabled
4a2fec
-if hwversion is specified.
4a2fec
-@item subformat
4a2fec
-Specifies which VMDK subformat to use. Valid options are
4a2fec
-@code{monolithicSparse} (default),
4a2fec
-@code{monolithicFlat},
4a2fec
-@code{twoGbMaxExtentSparse},
4a2fec
-@code{twoGbMaxExtentFlat} and
4a2fec
-@code{streamOptimized}.
4a2fec
-@end table
4a2fec
-
4a2fec
-@item vpc
4a2fec
-VirtualPC compatible image format (VHD).
4a2fec
-Supported options:
4a2fec
-@table @code
4a2fec
-@item subformat
4a2fec
-Specifies which VHD subformat to use. Valid options are
4a2fec
-@code{dynamic} (default) and @code{fixed}.
4a2fec
-@end table
4a2fec
-
4a2fec
-@item VHDX
4a2fec
-Hyper-V compatible image format (VHDX).
4a2fec
-Supported options:
4a2fec
-@table @code
4a2fec
-@item subformat
4a2fec
-Specifies which VHDX subformat to use. Valid options are
4a2fec
-@code{dynamic} (default) and @code{fixed}.
4a2fec
-@item block_state_zero
4a2fec
-Force use of payload blocks of type 'ZERO'.  Can be set to @code{on} (default)
4a2fec
-or @code{off}.  When set to @code{off}, new blocks will be created as
4a2fec
-@code{PAYLOAD_BLOCK_NOT_PRESENT}, which means parsers are free to return
4a2fec
-arbitrary data for those blocks.  Do not set to @code{off} when using
4a2fec
-@code{qemu-img convert} with @code{subformat=dynamic}.
4a2fec
-@item block_size
4a2fec
-Block size; min 1 MB, max 256 MB.  0 means auto-calculate based on image size.
4a2fec
-@item log_size
4a2fec
-Log size; min 1 MB.
4a2fec
-@end table
4a2fec
-@end table
4a2fec
-
4a2fec
-@subsubsection Read-only formats
4a2fec
-More disk image file formats are supported in a read-only mode.
4a2fec
-@table @option
4a2fec
-@item bochs
4a2fec
-Bochs images of @code{growing} type.
4a2fec
-@item cloop
4a2fec
-Linux Compressed Loop image, useful only to reuse directly compressed
4a2fec
-CD-ROM images present for example in the Knoppix CD-ROMs.
4a2fec
-@item dmg
4a2fec
-Apple disk image.
4a2fec
-@item parallels
4a2fec
-Parallels disk image format.
4a2fec
-@end table
4a2fec
-
4a2fec
-
4a2fec
-@node host_drives
4a2fec
-@subsection Using host drives
4a2fec
-
4a2fec
-In addition to disk image files, QEMU can directly access host
4a2fec
-devices. We describe here the usage for QEMU version >= 0.8.3.
4a2fec
-
4a2fec
-@subsubsection Linux
4a2fec
-
4a2fec
-On Linux, you can directly use the host device filename instead of a
4a2fec
-disk image filename provided you have enough privileges to access
4a2fec
-it. For example, use @file{/dev/cdrom} to access to the CDROM.
4a2fec
-
4a2fec
-@table @code
4a2fec
-@item CD
4a2fec
-You can specify a CDROM device even if no CDROM is loaded. QEMU has
4a2fec
-specific code to detect CDROM insertion or removal. CDROM ejection by
4a2fec
-the guest OS is supported. Currently only data CDs are supported.
4a2fec
-@item Floppy
4a2fec
-You can specify a floppy device even if no floppy is loaded. Floppy
4a2fec
-removal is currently not detected accurately (if you change floppy
4a2fec
-without doing floppy access while the floppy is not loaded, the guest
4a2fec
-OS will think that the same floppy is loaded).
4a2fec
-Use of the host's floppy device is deprecated, and support for it will
4a2fec
-be removed in a future release.
4a2fec
-@item Hard disks
4a2fec
-Hard disks can be used. Normally you must specify the whole disk
4a2fec
-(@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can
4a2fec
-see it as a partitioned disk. WARNING: unless you know what you do, it
4a2fec
-is better to only make READ-ONLY accesses to the hard disk otherwise
4a2fec
-you may corrupt your host data (use the @option{-snapshot} command
4a2fec
-line option or modify the device permissions accordingly).
4a2fec
-@end table
4a2fec
-
4a2fec
-@subsubsection Windows
4a2fec
-
4a2fec
-@table @code
4a2fec
-@item CD
4a2fec
-The preferred syntax is the drive letter (e.g. @file{d:}). The
4a2fec
-alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is
4a2fec
-supported as an alias to the first CDROM drive.
4a2fec
-
4a2fec
-Currently there is no specific code to handle removable media, so it
4a2fec
-is better to use the @code{change} or @code{eject} monitor commands to
4a2fec
-change or eject media.
4a2fec
-@item Hard disks
4a2fec
-Hard disks can be used with the syntax: @file{\\.\PhysicalDrive@var{N}}
4a2fec
-where @var{N} is the drive number (0 is the first hard disk).
4a2fec
-
4a2fec
-WARNING: unless you know what you do, it is better to only make
4a2fec
-READ-ONLY accesses to the hard disk otherwise you may corrupt your
4a2fec
-host data (use the @option{-snapshot} command line so that the
4a2fec
-modifications are written in a temporary file).
4a2fec
-@end table
4a2fec
-
4a2fec
-
4a2fec
-@subsubsection Mac OS X
4a2fec
-
4a2fec
-@file{/dev/cdrom} is an alias to the first CDROM.
4a2fec
-
4a2fec
-Currently there is no specific code to handle removable media, so it
4a2fec
-is better to use the @code{change} or @code{eject} monitor commands to
4a2fec
-change or eject media.
4a2fec
-
4a2fec
-@node disk_images_fat_images
4a2fec
-@subsection Virtual FAT disk images
4a2fec
-
4a2fec
-QEMU can automatically create a virtual FAT disk image from a
4a2fec
-directory tree. In order to use it, just type:
4a2fec
-
4a2fec
-@example
4a2fec
-qemu-kvm linux.img -hdb fat:/my_directory
4a2fec
-@end example
4a2fec
-
4a2fec
-Then you access access to all the files in the @file{/my_directory}
4a2fec
-directory without having to copy them in a disk image or to export
4a2fec
-them via SAMBA or NFS. The default access is @emph{read-only}.
4a2fec
-
4a2fec
-Floppies can be emulated with the @code{:floppy:} option:
4a2fec
-
4a2fec
-@example
4a2fec
-qemu-kvm linux.img -fda fat:floppy:/my_directory
4a2fec
-@end example
4a2fec
-
4a2fec
-A read/write support is available for testing (beta stage) with the
4a2fec
-@code{:rw:} option:
4a2fec
-
4a2fec
-@example
4a2fec
-qemu-kvm linux.img -fda fat:floppy:rw:/my_directory
4a2fec
-@end example
4a2fec
-
4a2fec
-What you should @emph{never} do:
4a2fec
-@itemize
4a2fec
-@item use non-ASCII filenames ;
4a2fec
-@item use "-snapshot" together with ":rw:" ;
4a2fec
-@item expect it to work when loadvm'ing ;
4a2fec
-@item write to the FAT directory on the host system while accessing it with the guest system.
4a2fec
-@end itemize
4a2fec
-
4a2fec
-@node disk_images_nbd
4a2fec
-@subsection NBD access
4a2fec
-
4a2fec
-QEMU can access directly to block device exported using the Network Block Device
4a2fec
-protocol.
4a2fec
-
4a2fec
-@example
4a2fec
-qemu-kvm linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/
4a2fec
-@end example
4a2fec
-
4a2fec
-If the NBD server is located on the same host, you can use an unix socket instead
4a2fec
-of an inet socket:
4a2fec
-
4a2fec
-@example
4a2fec
-qemu-kvm linux.img -hdb nbd+unix://?socket=/tmp/my_socket
4a2fec
-@end example
4a2fec
-
4a2fec
-In this case, the block device must be exported using qemu-nbd:
4a2fec
-
4a2fec
-@example
4a2fec
-qemu-nbd --socket=/tmp/my_socket my_disk.qcow2
4a2fec
-@end example
4a2fec
-
4a2fec
-The use of qemu-nbd allows sharing of a disk between several guests:
4a2fec
-@example
4a2fec
-qemu-nbd --socket=/tmp/my_socket --share=2 my_disk.qcow2
4a2fec
-@end example
4a2fec
-
4a2fec
-@noindent
4a2fec
-and then you can use it with two guests:
4a2fec
-@example
4a2fec
-qemu-kvm linux1.img -hdb nbd+unix://?socket=/tmp/my_socket
4a2fec
-qemu-kvm linux2.img -hdb nbd+unix://?socket=/tmp/my_socket
4a2fec
-@end example
4a2fec
-
4a2fec
-If the nbd-server uses named exports (supported since NBD 2.9.18, or with QEMU's
4a2fec
-own embedded NBD server), you must specify an export name in the URI:
4a2fec
-@example
4a2fec
-qemu-kvm -cdrom nbd://localhost/debian-500-ppc-netinst
4a2fec
-qemu-kvm -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst
4a2fec
-@end example
4a2fec
-
4a2fec
-The URI syntax for NBD is supported since QEMU 1.3.  An alternative syntax is
4a2fec
-also available.  Here are some example of the older syntax:
4a2fec
-@example
4a2fec
-qemu-kvm linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
4a2fec
-qemu-kvm linux2.img -hdb nbd:unix:/tmp/my_socket
4a2fec
-qemu-kvm -cdrom nbd:localhost:10809:exportname=debian-500-ppc-netinst
4a2fec
-@end example
4a2fec
-
4a2fec
-@node disk_images_sheepdog
4a2fec
-@subsection Sheepdog disk images
4a2fec
-
4a2fec
-Sheepdog is a distributed storage system for QEMU.  It provides highly
4a2fec
-available block level storage volumes that can be attached to
4a2fec
-QEMU-based virtual machines.
4a2fec
-
4a2fec
-You can create a Sheepdog disk image with the command:
4a2fec
-@example
4a2fec
-qemu-img create sheepdog:///@var{image} @var{size}
4a2fec
-@end example
4a2fec
-where @var{image} is the Sheepdog image name and @var{size} is its
4a2fec
-size.
4a2fec
-
4a2fec
-To import the existing @var{filename} to Sheepdog, you can use a
4a2fec
-convert command.
4a2fec
-@example
4a2fec
-qemu-img convert @var{filename} sheepdog:///@var{image}
4a2fec
-@end example
4a2fec
-
4a2fec
-You can boot from the Sheepdog disk image with the command:
4a2fec
-@example
4a2fec
-qemu-kvm sheepdog:///@var{image}
4a2fec
-@end example
4a2fec
-
4a2fec
-You can also create a snapshot of the Sheepdog image like qcow2.
4a2fec
-@example
4a2fec
-qemu-img snapshot -c @var{tag} sheepdog:///@var{image}
4a2fec
-@end example
4a2fec
-where @var{tag} is a tag name of the newly created snapshot.
4a2fec
-
4a2fec
-To boot from the Sheepdog snapshot, specify the tag name of the
4a2fec
-snapshot.
4a2fec
-@example
4a2fec
-qemu-kvm sheepdog:///@var{image}#@var{tag}
4a2fec
-@end example
4a2fec
-
4a2fec
-You can create a cloned image from the existing snapshot.
4a2fec
-@example
4a2fec
-qemu-img create -b sheepdog:///@var{base}#@var{tag} sheepdog:///@var{image}
4a2fec
-@end example
4a2fec
-where @var{base} is a image name of the source snapshot and @var{tag}
4a2fec
-is its tag name.
4a2fec
-
4a2fec
-You can use an unix socket instead of an inet socket:
4a2fec
-
4a2fec
-@example
4a2fec
-qemu-kvm sheepdog+unix:///@var{image}?socket=@var{path}
4a2fec
-@end example
4a2fec
-
4a2fec
-If the Sheepdog daemon doesn't run on the local host, you need to
4a2fec
-specify one of the Sheepdog servers to connect to.
4a2fec
-@example
4a2fec
-qemu-img create sheepdog://@var{hostname}:@var{port}/@var{image} @var{size}
4a2fec
-qemu-kvm sheepdog://@var{hostname}:@var{port}/@var{image}
4a2fec
-@end example
4a2fec
-
4a2fec
-@node disk_images_iscsi
4a2fec
-@subsection iSCSI LUNs
4a2fec
-
4a2fec
-iSCSI is a popular protocol used to access SCSI devices across a computer
4a2fec
-network.
4a2fec
-
4a2fec
-There are two different ways iSCSI devices can be used by QEMU.
4a2fec
-
4a2fec
-The first method is to mount the iSCSI LUN on the host, and make it appear as
4a2fec
-any other ordinary SCSI device on the host and then to access this device as a
4a2fec
-/dev/sd device from QEMU. How to do this differs between host OSes.
4a2fec
-
4a2fec
-The second method involves using the iSCSI initiator that is built into
4a2fec
-QEMU. This provides a mechanism that works the same way regardless of which
4a2fec
-host OS you are running QEMU on. This section will describe this second method
4a2fec
-of using iSCSI together with QEMU.
4a2fec
-
4a2fec
-In QEMU, iSCSI devices are described using special iSCSI URLs
4a2fec
-
4a2fec
-@example
4a2fec
-URL syntax:
4a2fec
-iscsi://[<username>[%<password>]@@]<host>[:<port>]/<target-iqn-name>/<lun>
4a2fec
-@end example
4a2fec
-
4a2fec
-Username and password are optional and only used if your target is set up
4a2fec
-using CHAP authentication for access control.
4a2fec
-Alternatively the username and password can also be set via environment
4a2fec
-variables to have these not show up in the process list
4a2fec
-
4a2fec
-@example
4a2fec
-export LIBISCSI_CHAP_USERNAME=<username>
4a2fec
-export LIBISCSI_CHAP_PASSWORD=<password>
4a2fec
-iscsi://<host>/<target-iqn-name>/<lun>
4a2fec
-@end example
4a2fec
-
4a2fec
-Various session related parameters can be set via special options, either
4a2fec
-in a configuration file provided via '-readconfig' or directly on the
4a2fec
-command line.
4a2fec
-
4a2fec
-If the initiator-name is not specified qemu-kvm will use a default name
4a2fec
-of 'iqn.2008-11.org.linux-kvm[:<uuid>'] where <uuid> is the UUID of the
4a2fec
-virtual machine. If the UUID is not specified qemu will use
4a2fec
-'iqn.2008-11.org.linux-kvm[:<name>'] where <name> is the name of the
4a2fec
-virtual machine.
4a2fec
-
4a2fec
-@example
4a2fec
-Setting a specific initiator name to use when logging in to the target
4a2fec
--iscsi initiator-name=iqn.qemu.test:my-initiator
4a2fec
-@end example
4a2fec
-
4a2fec
-@example
4a2fec
-Controlling which type of header digest to negotiate with the target
4a2fec
--iscsi header-digest=CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
4a2fec
-@end example
4a2fec
-
4a2fec
-These can also be set via a configuration file
4a2fec
-@example
4a2fec
-[iscsi]
4a2fec
-  user = "CHAP username"
4a2fec
-  password = "CHAP password"
4a2fec
-  initiator-name = "iqn.qemu.test:my-initiator"
4a2fec
-  # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
4a2fec
-  header-digest = "CRC32C"
4a2fec
-@end example
4a2fec
-
4a2fec
-
4a2fec
-Setting the target name allows different options for different targets
4a2fec
-@example
4a2fec
-[iscsi "iqn.target.name"]
4a2fec
-  user = "CHAP username"
4a2fec
-  password = "CHAP password"
4a2fec
-  initiator-name = "iqn.qemu.test:my-initiator"
4a2fec
-  # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
4a2fec
-  header-digest = "CRC32C"
4a2fec
-@end example
4a2fec
-
4a2fec
-
4a2fec
-Howto use a configuration file to set iSCSI configuration options:
4a2fec
-@example
4a2fec
-cat >iscsi.conf <
4a2fec
-[iscsi]
4a2fec
-  user = "me"
4a2fec
-  password = "my password"
4a2fec
-  initiator-name = "iqn.qemu.test:my-initiator"
4a2fec
-  header-digest = "CRC32C"
4a2fec
-EOF
4a2fec
-
4a2fec
-qemu-kvm -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
4a2fec
-    -readconfig iscsi.conf
4a2fec
-@end example
4a2fec
-
4a2fec
-
4a2fec
-Howto set up a simple iSCSI target on loopback and accessing it via QEMU:
4a2fec
-@example
4a2fec
-This example shows how to set up an iSCSI target with one CDROM and one DISK
4a2fec
-using the Linux STGT software target. This target is available on Red Hat based
4a2fec
-systems as the package 'scsi-target-utils'.
4a2fec
-
4a2fec
-tgtd --iscsi portal=127.0.0.1:3260
4a2fec
-tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
4a2fec
-tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \
4a2fec
-    -b /IMAGES/disk.img --device-type=disk
4a2fec
-tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
4a2fec
-    -b /IMAGES/cd.iso --device-type=cd
4a2fec
-tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
4a2fec
-
4a2fec
-qemu-kvm -iscsi initiator-name=iqn.qemu.test:my-initiator \
4a2fec
-    -boot d -drive file=iscsi://127.0.0.1/iqn.qemu.test/1 \
4a2fec
-    -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
4a2fec
-@end example
4a2fec
-
4a2fec
-@node disk_images_gluster
4a2fec
-@subsection GlusterFS disk images
4a2fec
-
4a2fec
-GlusterFS is a user space distributed file system.
4a2fec
-
4a2fec
-You can boot from the GlusterFS disk image with the command:
4a2fec
-@example
4a2fec
-URI:
4a2fec
-qemu-kvm -drive file=gluster[+@var{type}]://[@var{host}[:@var{port}]]/@var{volume}/@var{path}
4a2fec
-                               [?socket=...][,file.debug=9][,file.logfile=...]
4a2fec
-
4a2fec
-JSON:
4a2fec
-qemu-kvm 'json:@{"driver":"qcow2",
4a2fec
-                           "file":@{"driver":"gluster",
4a2fec
-                                    "volume":"testvol","path":"a.img","debug":9,"logfile":"...",
4a2fec
-                                    "server":[@{"type":"tcp","host":"...","port":"..."@},
4a2fec
-                                              @{"type":"unix","socket":"..."@}]@}@}'
4a2fec
-@end example
4a2fec
-
4a2fec
-@var{gluster} is the protocol.
4a2fec
-
4a2fec
-@var{type} specifies the transport type used to connect to gluster
4a2fec
-management daemon (glusterd). Valid transport types are
4a2fec
-tcp and unix. In the URI form, if a transport type isn't specified,
4a2fec
-then tcp type is assumed.
4a2fec
-
4a2fec
-@var{host} specifies the server where the volume file specification for
4a2fec
-the given volume resides. This can be either a hostname or an ipv4 address.
4a2fec
-If transport type is unix, then @var{host} field should not be specified.
4a2fec
-Instead @var{socket} field needs to be populated with the path to unix domain
4a2fec
-socket.
4a2fec
-
4a2fec
-@var{port} is the port number on which glusterd is listening. This is optional
4a2fec
-and if not specified, it defaults to port 24007. If the transport type is unix,
4a2fec
-then @var{port} should not be specified.
4a2fec
-
4a2fec
-@var{volume} is the name of the gluster volume which contains the disk image.
4a2fec
-
4a2fec
-@var{path} is the path to the actual disk image that resides on gluster volume.
4a2fec
-
4a2fec
-@var{debug} is the logging level of the gluster protocol driver. Debug levels
4a2fec
-are 0-9, with 9 being the most verbose, and 0 representing no debugging output.
4a2fec
-The default level is 4. The current logging levels defined in the gluster source
4a2fec
-are 0 - None, 1 - Emergency, 2 - Alert, 3 - Critical, 4 - Error, 5 - Warning,
4a2fec
-6 - Notice, 7 - Info, 8 - Debug, 9 - Trace
4a2fec
-
4a2fec
-@var{logfile} is a commandline option to mention log file path which helps in
4a2fec
-logging to the specified file and also help in persisting the gfapi logs. The
4a2fec
-default is stderr.
4a2fec
-
4a2fec
-
4a2fec
-
4a2fec
-
4a2fec
-You can create a GlusterFS disk image with the command:
4a2fec
-@example
4a2fec
-qemu-img create gluster://@var{host}/@var{volume}/@var{path} @var{size}
4a2fec
-@end example
4a2fec
-
4a2fec
-Examples
4a2fec
-@example
4a2fec
-qemu-kvm -drive file=gluster://1.2.3.4/testvol/a.img
4a2fec
-qemu-kvm -drive file=gluster+tcp://1.2.3.4/testvol/a.img
4a2fec
-qemu-kvm -drive file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img
4a2fec
-qemu-kvm -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img
4a2fec
-qemu-kvm -drive file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img
4a2fec
-qemu-kvm -drive file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img
4a2fec
-qemu-kvm -drive file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket
4a2fec
-qemu-kvm -drive file=gluster+rdma://1.2.3.4:24007/testvol/a.img
4a2fec
-qemu-kvm -drive file=gluster://1.2.3.4/testvol/a.img,file.debug=9,file.logfile=/var/log/qemu-gluster.log
4a2fec
-qemu-kvm 'json:@{"driver":"qcow2",
4a2fec
-                           "file":@{"driver":"gluster",
4a2fec
-                                    "volume":"testvol","path":"a.img",
4a2fec
-                                    "debug":9,"logfile":"/var/log/qemu-gluster.log",
4a2fec
-                                    "server":[@{"type":"tcp","host":"1.2.3.4","port":24007@},
4a2fec
-                                              @{"type":"unix","socket":"/var/run/glusterd.socket"@}]@}@}'
4a2fec
-qemu-kvm -drive driver=qcow2,file.driver=gluster,file.volume=testvol,file.path=/path/a.img,
4a2fec
-                                       file.debug=9,file.logfile=/var/log/qemu-gluster.log,
4a2fec
-                                       file.server.0.type=tcp,file.server.0.host=1.2.3.4,file.server.0.port=24007,
4a2fec
-                                       file.server.1.type=unix,file.server.1.socket=/var/run/glusterd.socket
4a2fec
-@end example
4a2fec
-
4a2fec
-@node disk_images_ssh
4a2fec
-@subsection Secure Shell (ssh) disk images
4a2fec
-
4a2fec
-You can access disk images located on a remote ssh server
4a2fec
-by using the ssh protocol:
4a2fec
-
4a2fec
-@example
4a2fec
-qemu-kvm -drive file=ssh://[@var{user}@@]@var{server}[:@var{port}]/@var{path}[?host_key_check=@var{host_key_check}]
4a2fec
-@end example
4a2fec
-
4a2fec
-Alternative syntax using properties:
4a2fec
-
4a2fec
-@example
4a2fec
-qemu-kvm -drive file.driver=ssh[,file.user=@var{user}],file.host=@var{server}[,file.port=@var{port}],file.path=@var{path}[,file.host_key_check=@var{host_key_check}]
4a2fec
-@end example
4a2fec
-
4a2fec
-@var{ssh} is the protocol.
4a2fec
-
4a2fec
-@var{user} is the remote user.  If not specified, then the local
4a2fec
-username is tried.
4a2fec
-
4a2fec
-@var{server} specifies the remote ssh server.  Any ssh server can be
4a2fec
-used, but it must implement the sftp-server protocol.  Most Unix/Linux
4a2fec
-systems should work without requiring any extra configuration.
4a2fec
-
4a2fec
-@var{port} is the port number on which sshd is listening.  By default
4a2fec
-the standard ssh port (22) is used.
4a2fec
-
4a2fec
-@var{path} is the path to the disk image.
4a2fec
-
4a2fec
-The optional @var{host_key_check} parameter controls how the remote
4a2fec
-host's key is checked.  The default is @code{yes} which means to use
4a2fec
-the local @file{.ssh/known_hosts} file.  Setting this to @code{no}
4a2fec
-turns off known-hosts checking.  Or you can check that the host key
4a2fec
-matches a specific fingerprint:
4a2fec
-@code{host_key_check=md5:78:45:8e:14:57:4f:d5:45:83:0a:0e:f3:49:82:c9:c8}
4a2fec
-(@code{sha1:} can also be used as a prefix, but note that OpenSSH
4a2fec
-tools only use MD5 to print fingerprints).
4a2fec
-
4a2fec
-Currently authentication must be done using ssh-agent.  Other
4a2fec
-authentication methods may be supported in future.
4a2fec
-
4a2fec
-Note: Many ssh servers do not support an @code{fsync}-style operation.
4a2fec
-The ssh driver cannot guarantee that disk flush requests are
4a2fec
-obeyed, and this causes a risk of disk corruption if the remote
4a2fec
-server or network goes down during writes.  The driver will
4a2fec
-print a warning when @code{fsync} is not supported:
4a2fec
-
4a2fec
-warning: ssh server @code{ssh.example.com:22} does not support fsync
4a2fec
-
4a2fec
-With sufficiently new versions of libssh2 and OpenSSH, @code{fsync} is
4a2fec
-supported.
4a2fec
+@include docs/qemu-block-drivers.texi
4a2fec
 
4a2fec
 @node pcsys_network
4a2fec
 @section Network emulation
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec