From abc7b14d7350dd938cb7c3a89508593f613c73d4 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 22 Apr 2023 17:10:40 +0200 Subject: [PATCH] Comments --- run/disk.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/run/disk.sh b/run/disk.sh index 4eb4e27..b12df10 100644 --- a/run/disk.sh +++ b/run/disk.sh @@ -37,6 +37,7 @@ if [ -f "${DATA}" ]; then if [ "$ALLOCATE" = "N" ]; then + # Resize file by changing its length truncate -s "${DATA_SIZE}" "${DATA}"; else @@ -51,6 +52,7 @@ if [ -f "${DATA}" ]; then echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATE=N." && exit 84 fi + # Resize file by allocating more space if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then echo "ERROR: Could not allocate a file for the virtual disk." && exit 85 fi @@ -78,10 +80,9 @@ fi if [ ! -f "${DATA}" ]; then - # Create an empty file - if [ "$ALLOCATE" = "N" ]; then + # Create an empty file truncate -s "${DATA_SIZE}" "${DATA}" else @@ -94,6 +95,7 @@ if [ ! -f "${DATA}" ]; then echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATE=N." && exit 86 fi + # Create an empty file if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then rm -f "${DATA}" echo "ERROR: Could not allocate a file for the virtual disk." && exit 87