I wanted to test a hard-drive that halted when its internal temperature raised above its safety level. hdparm is one option but the script below creates different files with a certain given size.
COUNTER=0
while [ true ]; do
dd if=/dev/zero of=file$COUNTER bs=$1 count=1024
let COUNTER=COUNTER+1
done
You can replace /dev/zero with /dev/random if you want random data. Call the script with one argument, the file size.