SmartOS manyfiles.sh is a bash script to create N files of size M. It uses the solaris mkfie(1M) command to create 0 padded files that can be small (1024) or rather large (100g for 100Gb file). Files are named TEMP_ZEROS_0000001 to N. Afterward, pbzip2 can be used to load up the system cpu and compress these in paralell to equal sized files (in …
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
Applies to SmartOS/illumOS/Solaris machines with the mkfile command. | |
For testing too many file effects, create 500,000 numbered 2k zero padded files: | |
#./manyfiles.sh 500000 2k | |
For maxing out file storage, then releasing, this makes 20 100Gb zero padded files, bzips them. | |
# ./manyfiles.sh 20 100g | |
# pbzip2 TEMP_* & | |
The 20 resulting files should be all exactly the same size in bytes. | |
You can get this script directly on the server console from the raw: | |
# wget --no-check-certificate http://tinyurl.com/aws966c | |
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 | |
if [ $# != 2 ] | |
then | |
echo "Uses Solaris mkfile to create some number of 0 filled files" | |
echo "usage `basename $0` [number of files] [size of files e.g. 100g]" | |
echo " " | |
exit 1 | |
fi | |
NUMCYC=0 | |
echo Number of Files: $1 | |
echo Size of Files: $2 | |
while [ $NUMCYC != $1 ] | |
do | |
let NUMCYC=$NUMCYC+1 | |
let LASTCYC=$NUMCYC-1 | |
echo mkfile instance: $NUMCYC | |
FILENUM=$NUMCYC | |
if [ $NUMCYC -lt 1000000 ] | |
then | |
FILENUM=0${FILENUM} | |
fi | |
if [ $NUMCYC -lt 100000 ] | |
then | |
FILENUM=0${FILENUM} | |
fi | |
if [ $NUMCYC -lt 10000 ] | |
then | |
FILENUM=0${FILENUM} | |
fi | |
if [ $NUMCYC -lt 1000 ] | |
then | |
FILENUM=0${FILENUM} | |
fi | |
if [ $NUMCYC -lt 100 ] | |
then | |
FILENUM=0${FILENUM} | |
fi | |
if [ $NUMCYC -lt 10 ] | |
then | |
FILENUM=0${FILENUM} | |
fi | |
echo mkfile -v ${2} TEMP_ZEROS_${FILENUM} | |
mkfile -v ${2} TEMP_ZEROS_${FILENUM} & | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment