Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ $# != 1 ]; then
- echo "$0 <target_dir>"
- exit 1
- fi
- if [ ! -e "$1" ]; then
- echo "Target dir does not exist, exiting."
- exit 1
- fi
- target_dir="$1"
- temp_dir="/tmp/filetest.$$"
- mkdir -p $temp_dir
- cd $temp_dir
- echo "Temp dir: $temp_dir"
- echo "Target dir: $target_dir"
- echo ""
- echo "Creating temp files..."
- i=0
- while [ 1 ]; do
- free_kbytes=`df -k $target_dir | tail -n 1 | awk '{ print $4; }'`
- if [ $free_kbytes -lt 200000 ]; then
- break
- fi
- file="temp${i}.tmp"
- echo "$file"
- dd if=/dev/urandom of=$file bs=1M count=200 2>/dev/null >/dev/null
- md5sum $file >> md5sum.txt
- mv $file $target_dir
- sync
- echo 3 > /proc/sys/vm/drop_caches
- i=$((i + 1))
- done
- echo ""
- echo "Checking temp files..."
- cd $target_dir
- md5sum -c < $temp_dir/md5sum.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement