diff --git a/src/disk.sh b/src/disk.sh index 6dca53ac..09334816 100644 --- a/src/disk.sh +++ b/src/disk.sh @@ -77,7 +77,7 @@ createDisk() { local DISK_SPACE=$2 local DISK_DESC=$3 local DISK_FMT=$4 - local DIR SPACE DATA_SIZE + local DATA_SIZE DIR SPACE DATA_SIZE=$(numfmt --from=iec "$DISK_SPACE") @@ -94,7 +94,8 @@ createDisk() { fi fi - local FAIL="Could not create a $DISK_SPACE $DISK_FMT file for $DISK_DESC ($DISK_FILE)" + info "Creating a $DISK_TYPE $DISK_DESC image in $DISK_FMT format with a size of $DISK_SPACE..." + local FAIL="Could not create a $DISK_TYPE $DISK_FMT $DISK_DESC image of $DISK_SPACE ($DISK_FILE)" case "${DISK_FMT,,}" in raw) @@ -158,7 +159,7 @@ resizeDisk() { local GB=$(( (CUR_SIZE + 1073741823)/1073741824 )) info "Resizing $DISK_DESC from ${GB}G to $DISK_SPACE..." - local FAIL="Could not resize $DISK_FMT file of $DISK_DESC ($DISK_FILE) from ${GB}G to $DISK_SPACE .." + local FAIL="Could not resize the $DISK_TYPE $DISK_FMT $DISK_DESC image from ${GB}G to $DISK_SPACE ($DISK_FILE)" case "${DISK_FMT,,}" in raw) @@ -233,7 +234,7 @@ convertDisk() { # shellcheck disable=SC2086 if ! qemu-img convert -f "$SOURCE_FMT" $CONV_FLAGS -o "$DISK_OPTS" -O "$DST_FMT" -- "$SOURCE_FILE" "$TMP_FILE"; then rm -f "$TMP_FILE" - error "Failed to convert $DISK_DESC to $DST_FMT format in $DIR, is there enough space available?" && exit 79 + error "Failed to convert $DISK_TYPE $DISK_DESC image to $DST_FMT format in $DIR, is there enough space available?" && exit 79 fi if [[ "$DST_FMT" == "raw" ]]; then @@ -340,8 +341,10 @@ fi DISK_EXT="$(fmt2ext "$DISK_FMT")" || exit $? if [[ "$ALLOCATE" == [Nn]* ]]; then + DISK_TYPE="growable" DISK_ALLOC="preallocation=off" else + DISK_TYPE="preallocated" DISK_ALLOC="preallocation=falloc" fi