Commit 26d949c8 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Fix a bug where img copying truncated the disks

Add conv=notrunc when copying images to disks. If the disk-template
is file, using dd to copy the image into the disk would truncate the

This bug was introduced in version 0.20 where support for disk URIs
was added. Prior to that, all file disks were always losetup-ed.
parent 002d3a1f
......@@ -170,9 +170,9 @@ if [ "$BACKEND_TYPE" = "local" ]; then
# Deploying an image file on a target block device is a streaming copy
# operation. Enable the direct I/O flag on the output fd to avoid polluting
# the host cache with useless data.
$monitor $DD bs=4M if="$image_file" of="$target" oflag=direct iflag=fullblock
$monitor $DD bs=4M if="$image_file" of="$target" oflag=direct iflag=fullblock conv=notrunc
$image_cmd | $monitor $DD bs=4M of="$target" oflag=direct iflag=fullblock
$image_cmd | $monitor $DD bs=4M of="$target" oflag=direct iflag=fullblock conv=notrunc
report_info "Image copy finished."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment