Created
March 17, 2016 22:47
-
-
Save pfactum/1b4129b6ed77b6c48da4 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
iters=1000000 | |
index=0 | |
folders=0 | |
mount="/mnt/net/glusterfs/test" | |
while ((index < ${iters})); do | |
echo -ne "${index}/${iters}\r" | |
hash=$(echo ${index} | md5sum | awk '{print($1)}') | |
p1=$(echo ${hash} | cut -c 1-2) | |
p2=$(echo ${hash} | cut -c 3-4) | |
p3=$(echo ${hash} | cut -c 5-6) | |
if [[ ! -d "${mount}/${p1}" ]]; then | |
mkdir -p "${mount}/${p1}" | |
((folders++)) | |
fi | |
if [[ ! -d "${mount}/${p1}/${p2}" ]]; then | |
mkdir -p "${mount}/${p1}/${p2}" | |
((folders++)) | |
fi | |
if [[ ! -d "${mount}/${p1}/${p2}/${p3}" ]]; then | |
mkdir -p "${mount}/${p1}/${p2}/${p3}" | |
((folders++)) | |
fi | |
folder="${mount}/${p1}/${p2}/${p3}" | |
size=${RANDOM} | |
((size++)) | |
dd if=/dev/zero of=${folder}/${hash} bs=${size} count=1 status=none | |
((index++)) | |
done | |
echo -ne "\n" | |
echo Files: ${index} | |
echo Folders: ${folders} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment