#!/bin/bash

if [ ! -b "$1" ]; then
    echo test.sh mountpoint prefix
fi

pre=${2:-tst}
echo using prefix: $pre

echo mounting
mount "$1" /mnt
if [ $? -ne 0 ]; then
  echo something wrong
  exit
fi
echo mkdir
mkdir -p /mnt/stats/$pre
echo sync
sync
echo wait 30 seconds
sleep 30
echo "start test (10 minutes)"
date > $pre.starttime
(dstat > $pre.dstat)&
(t=0; while sleep 10; do ((t+=10)); echo -en "$t/600\r"; done)&
timeout 600 find /mnt -path '*/[cn][ue][rw]/*' -ls > /mnt/stats/$pre/find
kill %1 %2
date > $pre.endtime
echo -n "count: "
wc -l /mnt/stats/$pre/find
wc -l /mnt/stats/$pre/find > $pre.count
umount "$1"

Add a code snippet to your website: www.paste.org