Created
November 23, 2023 20:07
-
-
Save djfm/502d6015580a3a2a038eecbab56929e8 to your computer and use it in GitHub Desktop.
Try to saturate a hard-disk to check its capacity using standard Linux commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
target="$1" | |
if ! [ -d "$target" ]; then | |
echo "Usage: $0 <directory>" | |
exit 1 | |
fi | |
#supposed capacity of the disk in GB | |
num_tbs=32000 | |
gs=4 | |
(("count = $num_tbs / $gs")) | |
for i in $(seq 1 "$count"); do | |
of=$(printf "file-%05d" "$i") | |
file="$target/$of" | |
echo "writing ${gs}G to $file..." | |
dd if=/dev/random of="$file" bs="$gs"G count=1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment