LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > sag47
User Name
Password

Notices


Rate this Entry

Stress testing a new hard drive...

Posted 11-20-2011 at 10:38 PM by sag47
Updated 11-20-2011 at 10:40 PM by sag47
Tags hardware

You should always stress test a new harddrive when you buy it.

Some people say, "Just hook it up for a few months and keep unimportant data on it. If it breaks in that 1-3 month time then it will be good for 3 or 4 years."

While that metric is okay at best I prefer to take a more systematic approach to it. I want to fill the whole hard drive with random 1 and 0 over a constant and long period of time. I do that because you are stressing the hard drive out with max writes for a long period of time (I usually do it for 7 days before I'll pass the hard drive). If the hard drive fails within those 7 days then it was going to break within a month or two likely.

I encountered just that situation over the past day. Here are the scripts I ran to stress it out (run as root).

hdd-stress.sh
Code:
#!/bin/bash

while true;do
  dd if=/dev/zero of=/dev/sdk &> /root/log.txt
  sleep 2
done
hdd-stress2.sh
Code:
#!/bin/bash

while true;do
  dd if=/dev/urandom of=/dev/sdk &> /root/log2.txt
  sleep 2
done
hdd-stress-killall.sh
Code:
#!/bin/bash
#kill the scripts
ps aux | grep 'bash.*hdd' | grep -v 'grep' | awk '{print $2}' | xargs kill -15
killall dd
To run them just sub it so that it doesn't kill when you log out.
Code:
su - -c '/root/hdd-stress.sh &'
After 3 straight days of letting it run with a nice value of 0 here is the result from the tail of dmesg.

Code:
... it continues for a long time up ...

[42931.558804] sd 7:0:0:0: [sdk] Unhandled error code
[42931.558807] sd 7:0:0:0: [sdk] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[42931.558812] sd 7:0:0:0: [sdk] CDB: Read(10): 28 00 e8 e0 88 a8 00 00 08 00
[42931.558821] end_request: I/O error, dev sdk, sector 3907029160
[42931.558825] Buffer I/O error on device sdk, logical block 488378645
[42931.565946] Buffer I/O error on device sdk, logical block 2
[42931.567031] Buffer I/O error on device sdk, logical block 3
[42931.568285] sd 7:0:0:0: [sdk] Unhandled error code
[42931.568289] sd 7:0:0:0: [sdk] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[42931.568295] sd 7:0:0:0: [sdk] CDB: Read(10): 28 00 00 00 00 00 00 00 20 00
[42931.568310] end_request: I/O error, dev sdk, sector 0
[42931.569451] Buffer I/O error on device sdk, logical block 0
[42931.570577] Buffer I/O error on device sdk, logical block 1
[42931.570615] sd 7:0:0:0: [sdk] Unhandled error code
[42931.570619] sd 7:0:0:0: [sdk] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
[42931.570624] sd 7:0:0:0: [sdk] CDB: Read(10): 28 00 00 00 00 00 00 00 08 00
[42931.570634] end_request: I/O error, dev sdk, sector 0
[42931.570638] Buffer I/O error on device sdk, logical block 0
It's a good thing I did this before giving my brother his present. It would have been really annoying if he had to been the one to have to RMA it.

SAM
Posted in Uncategorized
Views 17933 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 03:05 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration