mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
Always allocate
This commit is contained in:
commit
ec492d55e1
27
run/disk.sh
27
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
|
||||
fi
|
||||
|
||||
if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then
|
||||
echo "ERROR: Could not allocate a file for the virtual disk." && exit 85
|
||||
fi
|
||||
|
||||
if [ "$ALLOCATE" = "Z" ]; then
|
||||
|
||||
GB=$(( (REQ + 1073741823)/1073741824 ))
|
||||
echo "INFO: Writing ${GB} GB of random data, please wait.."
|
||||
|
||||
echo "INFO: Preallocating ${GB} GB of diskspace, 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
|
||||
echo "ERROR: Could not allocate a file for the virtual disk." && exit 85
|
||||
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
|
||||
fi
|
||||
|
||||
if ! fallocate -l "${DATA_SIZE}" "${DATA}"; then
|
||||
rm -f "${DATA}"
|
||||
echo "ERROR: Could not allocate a file for the virtual disk." && exit 87
|
||||
fi
|
||||
|
||||
if [ "$ALLOCATE" = "Z" ]; then
|
||||
|
||||
echo "INFO: Writing ${DISK_SIZE} of random data, please wait.."
|
||||
|
||||
echo "INFO: Preallocating ${DISK_SIZE} of diskspace, 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
|
||||
rm -f "${DATA}"
|
||||
echo "ERROR: Could not allocate a file for the virtual disk." && exit 87
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -103,7 +103,7 @@ BOOT=$(find $TMP -name "*.bin.zip")
|
||||
BOOT=$(echo "$BOOT" | head -c -5)
|
||||
unzip -q -o "$BOOT".zip -d $TMP
|
||||
|
||||
echo "Install: Creating partition table..."
|
||||
[ "$ALLOCATE" != "Z" ] && echo "Install: Allocating diskspace..."
|
||||
|
||||
SYSTEM="$TMP/sys.img"
|
||||
SYSTEM_SIZE=4954537983
|
||||
@ -115,8 +115,17 @@ if (( SYSTEM_SIZE > SPACE )); then
|
||||
echo "ERROR: Not enough free space to create a 4 GB system disk." && exit 87
|
||||
fi
|
||||
|
||||
echo "Install: Allocating diskspace..."
|
||||
dd if=/dev/urandom of="${SYSTEM}" count="${SYSTEM_SIZE}" bs=1M iflag=count_bytes status=none
|
||||
if ! fallocate -l "${SYSTEM_SIZE}" "${SYSTEM}"; then
|
||||
rm -f "${SYSTEM}"
|
||||
echo "ERROR: Could not allocate a file for the system disk." && exit 88
|
||||
fi
|
||||
|
||||
if [ "$ALLOCATE" = "Z" ]; then
|
||||
|
||||
echo "Install: Preallocating 4 GB of diskspace..."
|
||||
dd if=/dev/urandom of="${SYSTEM}" count="${SYSTEM_SIZE}" bs=1M iflag=count_bytes status=none
|
||||
|
||||
fi
|
||||
|
||||
# Check if file exists
|
||||
if [ ! -f "${SYSTEM}" ]; then
|
||||
@ -131,6 +140,8 @@ if [[ SIZE -ne SYSTEM_SIZE ]]; then
|
||||
echo "ERROR: System disk has the wrong size: ${SIZE}" && exit 90
|
||||
fi
|
||||
|
||||
echo "Install: Creating partition table..."
|
||||
|
||||
PART="$TMP/partition.fdisk"
|
||||
|
||||
{ echo "label: dos"
|
||||
|
Loading…
x
Reference in New Issue
Block a user