Write random data instead of zeroes

When writing zeroes the underlying virtio driver detects and skips them, so fill the file with random data instead.
This commit is contained in:
Kroese 2023-04-19 05:27:54 +02:00 committed by GitHub
commit b9c2e1cba2
2 changed files with 6 additions and 6 deletions

View File

@ -48,9 +48,9 @@ if [ -f "${DATA}" ]; then
if [ "$ALLOCATE" = "Z" ]; then
GB=$(( (REQ + 1073741823)/1073741824 ))
echo "INFO: Writing ${GB} GB of zeroes, please wait.."
echo "INFO: Writing ${GB} GB of random data, please wait.."
dd if=/dev/zero of="${DATA}" seek="${OLD_SIZE}" count="${REQ}" bs=1M iflag=count_bytes oflag=seek_bytes
dd if=/dev/urandom of="${DATA}" seek="${OLD_SIZE}" count="${REQ}" bs=1M iflag=count_bytes oflag=seek_bytes status=none
else
@ -92,9 +92,9 @@ if [ ! -f "${DATA}" ]; then
if [ "$ALLOCATE" = "Z" ]; then
echo "INFO: Writing ${DISK_SIZE} of zeroes, please wait.."
echo "INFO: Writing ${DISK_SIZE} of random data, please wait.."
dd if=/dev/zero of="${DATA}" count="${DATA_SIZE}" bs=1M iflag=count_bytes
dd if=/dev/urandom of="${DATA}" count="${DATA_SIZE}" bs=1M iflag=count_bytes status=none
else

View File

@ -127,9 +127,9 @@ if [ "$ALLOCATE" != "Z" ]; then
else
GB=$(( (SYSTEM_SIZE + 1073741823)/1073741824 ))
echo "Install: Writing ${GB} GB of zeroes, please wait.."
echo "Install: Writing ${GB} GB of random data, please wait.."
dd if=/dev/zero of="${SYSTEM}" count="${SYSTEM_SIZE}" bs=1M iflag=count_bytes
dd if=/dev/urandom of="${SYSTEM}" count="${SYSTEM_SIZE}" bs=1M iflag=count_bytes status=none
fi