mirror of
https://github.com/AlbrechtL/openwrt-docker.git
synced 2026-10-15 08:01:26 +00:00
Check free diskspace
This commit is contained in:
@@ -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="\
|
||||
|
||||
Reference in New Issue
Block a user