Created
April 1, 2022 07:06
-
-
Save hyongbai/131b95fe5aa1bc4594b8b6e9bf0768c2 to your computer and use it in GitHub Desktop.
cram up your drive with random files
This file contains 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
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