Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This script is meant to test a drive to see if it's okay or not, by
- # writing 100M files (filled with zeroes) until the space runs out.
- set -eo pipefail
- if [[ ! -d $1 ]]; then
- echo -e "Usage: $(basename "$0") [dir]\n"
- exit
- fi
- dir=$(readlink -f "$1")
- out_dir="${dir}/zero-${RANDOM}"
- mkdir -p "$out_dir"
- n='0'
- while [[ $? -eq 0 ]]; do
- n=$(( n + 1 ))
- of="${out_dir}/zero_${n}"
- if [[ ! -f $of ]]; then
- dd if=/dev/urandom of="$of" bs=1M count=100
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement