From 86ce1f6e2b73b33c4a52818e245378bf52d27200 Mon Sep 17 00:00:00 2001 From: Reda Sallahi Date: Wed, 10 Aug 2016 04:43:12 +0200 Subject: qemu-img: add the 'dd' subcommand This patch adds a basic dd subcommand analogous to dd(1) to qemu-img. For the start, this implements the bs, if, of and count options and requires both if and of to be specified (no stdin/stdout if not specified) and doesn't support tty, pipes, etc. The image format must be specified with -O for the output if the raw format is not the intended one. Two tests are added to test qemu-img dd. Signed-off-by: Reda Sallahi Message-id: 20160810024312.14544-1-fullmanet@gmail.com Reviewed-by: Stefan Hajnoczi [mreitz: Moved test 158 to 170] Signed-off-by: Max Reitz --- qemu-img.texi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'qemu-img.texi') diff --git a/qemu-img.texi b/qemu-img.texi index 449a19c710..880293aefa 100644 --- a/qemu-img.texi +++ b/qemu-img.texi @@ -139,6 +139,20 @@ Parameters to convert subcommand: Skip the creation of the target volume @end table +Parameters to dd subcommand: + +@table @option + +@item bs=@var{block_size} +defines the block size +@item count=@var{blocks} +sets the number of input blocks to copy +@item if=@var{input} +sets the input file +@item of=@var{output} +sets the output file +@end table + Command description: @table @option @@ -310,6 +324,17 @@ skipped. This is useful for formats such as @code{rbd} if the target volume has already been created with site specific options that cannot be supplied through qemu-img. +@item dd [-f @var{fmt}] [-O @var{output_fmt}] [bs=@var{block_size}] [count=@var{blocks}] if=@var{input} of=@var{output} + +Dd copies from @var{input} file to @var{output} file converting it from +@var{fmt} format to @var{output_fmt} format. + +The data is by default read and written using blocks of 512 bytes but can be +modified by specifying @var{block_size}. If count=@var{blocks} is specified +dd will stop reading input after reading @var{blocks} input blocks. + +The size syntax is similar to dd(1)'s size syntax. + @item info [-f @var{fmt}] [--output=@var{ofmt}] [--backing-chain] @var{filename} Give information about the disk image @var{filename}. Use it in -- cgit v1.2.1