Skip to content

Instantly share code, notes, and snippets.

@gma
Created October 30, 2020 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gma/0bf79da9d8105d7d3b49f4f18dd246dd to your computer and use it in GitHub Desktop.
Save gma/0bf79da9d8105d7d3b49f4f18dd246dd to your computer and use it in GitHub Desktop.
#!/bin/bash
GIGABYTES="${1:-1}"
ITERATIONS="${2:-1}"
MOUNT="/mnt/tank"
sshhh() {
grep -v "+0 records"
}
for i in $(seq $ITERATIONS); do
FILE="$MOUNT/${GIGABYTES}GB"
echo -n "Writing: "
sudo dd if=/dev/zero of="$FILE" count=$GIGABYTES bs=1G oflag=dsync 2>&1 | sshhh
echo -n "Reading: "
echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null
dd if="$FILE" of=/dev/null bs=8k 2>&1 | sshhh
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment