mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-06-08 09:27:45 +08:00
Always allocate
This commit is contained in:
parent
d6bb08b029
commit
13bd4c60ea
29
run/disk.sh
29
run/disk.sh
@ -45,19 +45,17 @@ if [ -f "${DATA}" ]; then
|
|||||||
echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATION=N." && exit 84
|
echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATION=N." && exit 84
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ALLOCATE" = "Z" ]; then
|
|
||||||
|
|
||||||
GB=$(( (REQ + 1073741823)/1073741824 ))
|
|
||||||
echo "INFO: Writing ${GB} GB of random data, please wait.."
|
|
||||||
|
|
||||||
dd if=/dev/urandom of="${DATA}" seek="${OLD_SIZE}" count="${REQ}" bs=1M iflag=count_bytes oflag=seek_bytes status=none
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then
|
if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then
|
||||||
echo "ERROR: Could not allocate a file for the virtual disk." && exit 85
|
echo "ERROR: Could not allocate a file for the virtual disk." && exit 85
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$ALLOCATE" = "Z" ]; then
|
||||||
|
|
||||||
|
GB=$(( (REQ + 1073741823)/1073741824 ))
|
||||||
|
|
||||||
|
echo "INFO: Preallocating ${GB} GB with random data, please wait.."
|
||||||
|
dd if=/dev/urandom of="${DATA}" seek="${OLD_SIZE}" count="${REQ}" bs=1M iflag=count_bytes oflag=seek_bytes status=none
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -90,19 +88,16 @@ if [ ! -f "${DATA}" ]; then
|
|||||||
echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATION=N." && exit 86
|
echo "ERROR: Specify a smaller size or disable preallocation with ALLOCATION=N." && exit 86
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ALLOCATE" = "Z" ]; then
|
|
||||||
|
|
||||||
echo "INFO: Writing ${DISK_SIZE} of random data, please wait.."
|
|
||||||
|
|
||||||
dd if=/dev/urandom of="${DATA}" count="${DATA_SIZE}" bs=1M iflag=count_bytes status=none
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then
|
if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then
|
||||||
rm -f "${DATA}"
|
rm -f "${DATA}"
|
||||||
echo "ERROR: Could not allocate a file for the virtual disk." && exit 87
|
echo "ERROR: Could not allocate a file for the virtual disk." && exit 87
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$ALLOCATE" = "Z" ]; then
|
||||||
|
|
||||||
|
echo "INFO: Preallocating ${DISK_SIZE} with random data, please wait.."
|
||||||
|
dd if=/dev/urandom of="${DATA}" count="${DATA_SIZE}" bs=1M iflag=count_bytes status=none
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user