mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-12-14 14:20:32 +08:00
Check free diskspace
This commit is contained in:
5
disk.sh
5
disk.sh
@@ -14,7 +14,10 @@ DATA="$IMG/data$DISK_SIZE.img"
|
|||||||
|
|
||||||
if [ ! -f "$DATA" ]; then
|
if [ ! -f "$DATA" ]; then
|
||||||
# Create an empty file
|
# Create an empty file
|
||||||
fallocate -l "${NEW_SIZE}" "${DATA}"
|
if ! fallocate -l "${NEW_SIZE}" "${DATA}"; then
|
||||||
|
rm -f "${DATA}"
|
||||||
|
echo "ERROR: Not enough free space to create virtual disk." && exit 88
|
||||||
|
fi
|
||||||
# Format as BTRFS filesystem
|
# Format as BTRFS filesystem
|
||||||
mkfs.btrfs -q -L data -d single -m dup "${DATA}" > /dev/null
|
mkfs.btrfs -q -L data -d single -m dup "${DATA}" > /dev/null
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -101,7 +101,11 @@ echo "Install: Creating partition table..."
|
|||||||
|
|
||||||
SYSTEM="$TMP/sys.img"
|
SYSTEM="$TMP/sys.img"
|
||||||
SYSTEM_SIZE="4954537983"
|
SYSTEM_SIZE="4954537983"
|
||||||
fallocate -l "${SYSTEM_SIZE}" "${SYSTEM}"
|
|
||||||
|
if ! fallocate -l "${SYSTEM_SIZE}" "${SYSTEM}"; then
|
||||||
|
rm -f "${SYSTEM}"
|
||||||
|
echo "ERROR: Not enough free space to create virtual disk." && exit 88
|
||||||
|
fi
|
||||||
|
|
||||||
PART="$TMP/partition.fdisk"
|
PART="$TMP/partition.fdisk"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user