Created
August 24, 2021 13:47
-
-
Save coreone/c87300ca5bc2c691f5b569716e63d257 to your computer and use it in GitHub Desktop.
Script to fill a path with 32G 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
#!/bin/bash | |
function usage() { | |
echo "usage: $0 <path> <total size in GB>" | |
} | |
if [ -z "$1" ]; then | |
usage | |
exit 1 | |
fi | |
path=$1 | |
if [ -z "$2" ]; then | |
usage | |
exit 1 | |
fi | |
if [ ! -d "$path" ]; then | |
echo "${path} is not a directory" | |
exit 3 | |
fi | |
# Calculate the number of files to create | |
(( num_files=$2/32 )) | |
for num in $( seq -f "%03g" "$num_files" ); do | |
filepath="${path}/orafill${num}" | |
if [ -f "$filepath" ]; then | |
echo "${filepath} already exists...skipping" | |
else | |
echo "Creating ${filepath}" | |
time dd if=/dev/zero bs=33554432 count=1024 of="${path}/orafill${num}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment