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.
while [ true ]; do
dd if=/dev/zero of=file$COUNTER bs=$1 count=1024
You can replace /dev/zero with /dev/random if you want random data. Call the script with one argument, the file size.