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

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