Commit 2d4b6e8b authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Check free diskspace

parent d3401b82
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -8,7 +8,14 @@ DISK_SIZE=$(echo "${DISK_SIZE}" | sed 's/MB/M/g;s/GB/G/g;s/TB/T/g')
DATA_SIZE=$(numfmt --from=iec "${DISK_SIZE}")

DATA="$IMG/data${DISK_SIZE}.img"
[ ! -f "$DATA" ] && fallocate -l "${DATA_SIZE}" "${DATA}"

if [ ! -f "$DATA" ]; then
  if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then
    rm -f "${DATA}"
    echo "ERROR: Not enough free space to create virtual disk." && exit 82
  fi
fi

[ ! -f "$DATA" ] && echo "ERROR: Data image does not exist ($DATA)" && exit 83

KVM_DISK_OPTS="\