Unverified Commit 7d65529d authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Preallocate by default

parent 702d0770
Loading
Loading
Loading
Loading
+2 −17
Original line number Diff line number Diff line
@@ -115,24 +115,9 @@ if (( SYSTEM_SIZE > SPACE )); then
  echo "ERROR: Not enough free space to create a 4 GB system disk." && exit 87
fi

if [ "$ALLOCATE" != "Z" ]; then

  # Cannot use truncate here because of swap partition

  if ! fallocate -l "${SYSTEM_SIZE}" "${SYSTEM}"; then
    rm -f "${SYSTEM}"
    echo "ERROR: Could not allocate a file for the system disk." && exit 88
  fi

else

  GB=$(( (SYSTEM_SIZE + 1073741823)/1073741824 ))
  echo "Install: Writing ${GB} GB of random data, please wait.."

echo "Install: Allocating 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
    echo "ERROR: System disk does not exist ($SYSTEM)" && exit 89