Skip to main content

Linux Stress Testing Tips and Tricks

Disk Stress & Fault Test

Create a 1GB file with 1000 x 1MB blocks.
localhost:/$ dd if=/dev/zero of=/tmp/temp-file.tmp bs=1M count=1000

Output expected with time it takes and disk write speed in MB/s
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 6.83976 s, 153 MB/s


Now you can run a md5sum check to see if the infomration in memory and disk appears correctly and if all md5sums identify any mismatch which would indicate a faulty disk or RAM.



localhost:/$ for i in {1..5}; do md5sum /tmp/temp-file.tmp; done

Output usualyl expected in below format
e5c834fbdaa6bfd8eac5eb9404eefdd4  /tmp/temp-file.tmp
e5c834fbdaa6bfd8eac5eb9404eefdd4  /tmp/temp-file.tmp
e5c834fbdaa6bfd8eac5eb9404eefdd4  /tmp/temp-file.tmp
e5c834fbdaa6bfd8eac5eb9404eefdd4  /tmp/temp-file.tmp
e5c834fbdaa6bfd8eac5eb9404eefdd4  /tmp/temp-file.tmp



CPU Stress Test

Output a string repeatedly until killed and direct the output to nothing will consume very high cpu.
yes I am here >/dev/null

If above one process doesn't generate sufficient load on your CPU you could also try forking multiple processes with same syntax in background until you are smoked your processor and satisfied.

for i in `seq 1 20` ; do (yes I am here >/dev/null &) ; done

Above will generate 20 processes and run in background. The only way to kill them would be either killing your bash session or using follwoing command.

killall yes