Set raw image size to be multiple of 64k
This works around a bug in qemu-img causing it to sometimes error if compressing a raw image that isn't a multiple of 64k (the qcow2 cluster size). https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1180021 http://lists.gnu.org/archive/html/qemu-devel/2013-04/msg02520.html Change-Id: I88f8bb5c6bf3606ef5856b085a284af6b8858dbb
This commit is contained in:
parent
a495079695
commit
e8c73cde49
1 changed files with 5 additions and 1 deletions
|
@ -125,7 +125,11 @@ if [ -n "$DIB_IMAGE_SIZE" ]; then
|
||||||
truncate -s${DIB_IMAGE_SIZE}G $TMP_IMAGE_PATH
|
truncate -s${DIB_IMAGE_SIZE}G $TMP_IMAGE_PATH
|
||||||
else
|
else
|
||||||
# in kb*0.75 - underreport to get a slightly bigger device
|
# in kb*0.75 - underreport to get a slightly bigger device
|
||||||
_NEEDED_SIZE=$(sudo du --block-size=750 -x -s ${TMP_BUILD_DIR}/built | awk ' { print $1 } ')
|
# Rounding down size so that is is a multiple of 64, works around a bug in
|
||||||
|
# qemu-img that may occur when compressing raw images that aren't a multiple
|
||||||
|
# of 64k. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1180021
|
||||||
|
_NEEDED_SIZE=$(sudo du --block-size=750 -x -s ${TMP_BUILD_DIR}/built | \
|
||||||
|
awk ' { print $1 - ( $1 % 64) } ')
|
||||||
truncate -s${_NEEDED_SIZE}K $TMP_IMAGE_PATH
|
truncate -s${_NEEDED_SIZE}K $TMP_IMAGE_PATH
|
||||||
if [ "$FS_TYPE" = "ext4" ] ; then
|
if [ "$FS_TYPE" = "ext4" ] ; then
|
||||||
# Very conservative to handle images being resized a lot
|
# Very conservative to handle images being resized a lot
|
||||||
|
|
Loading…
Reference in a new issue