Skip to content

Instantly share code, notes, and snippets.

@hyongbai
Created April 1, 2022 07:06
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 hyongbai/131b95fe5aa1bc4594b8b6e9bf0768c2 to your computer and use it in GitHub Desktop.
Save hyongbai/131b95fe5aa1bc4594b8b6e9bf0768c2 to your computer and use it in GitHub Desktop.
cram up your drive with random files
cram_drive() {
local names=(
# "100gb 100*2**30"
# "10gb 10*2**30"
"2gb 2*2**30"
"1gb 2**30"
"100mb 100*2**20"
"10mb 10*2**20"
"1mb 2**20"
"100kb 100*2**10"
"10kb 10*2**10"
"1kb 2**10");
function create_file() {
local name="${1}"
local size="${2}"
local maxCount=10000
#
mkdir -p $name;
for it in {00000..${maxCount}}; do {
local file="${name}/${name}_${it}.txt"
echo "${file}"
openssl rand -out ${file} -base64 $(( ${size} * 3/4 )) || return 1
}; done
}
for name in $names; do {
echo ">>> ${name}"
create_file `echo ${name}`
}; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment