New hard-drive "burn-in" in FreeBSD?

I've just gotten some new HDDs and desired to burn them in. So using this thread, I'll share what I did and why. It's not novel, but I think it works and it may save someone some time.

  1. Install badblocks.
    # portmaster sysutils/e2fsprogs
  2. Open up a terminal for each HDD. Here is where having some e-SATA docks comes in really handy - individually doing this takes a long time but it can be done in parallel.
  3. Run this script.
    # ./hdd_burn_in.sh ada3

Code:
#!/bin/sh

# This stress tests a new HDD (e.g. ada3, or da3) by reading and writing
# different patterns, then doing a smartctl long test, then checking the 
# smartctl output.

# you will need to install sysutils/e2fsprogs to get badblocks to run.
# e.g. # portmaster sysutils/e2fsprogs

# Usage: # ./hdd_burn_in.sh ada3

passcount=4

echo
echo "*******************************************************"
echo "New hdd stress test."
echo "Beginning $passcount pass read write test on $1."
badblocks -wsv -p${passcount} /dev/$1

echo "Beginning smartctl long test on $1."
/usr/local/sbin/smartctl -t long $1

echo "Checking SMART data."
/usr/local/sbin/smartctl -a $1

Actually, I do my own hdd_early_warning.sh script there instead of the last command, but that's something for another post. Badblocks command from here.

A few comments. I think it's good to reverse the bits in between writes, more chance of doing something that will provoke an error. Because there is no /dev/one, or using tr slows a 135MB/s HDD down to 45MB/s, badblocks is a better alternative than dd. Using badblocks has the benefit of comparing what is coming off the HDD with what was written and notifying in the case of an error, as well as by default how any write and read from the HDD will change the SMART data if there has been an error.

The last pass of badblocks zeros the drive, which is how we want to leave it, so no need for a dd run of /dev/zero.

The SMART long test gives one of the necessary datums for predicting drive failure, that's why we do that at the end.

And we should check the SMART data at the end to see if any errors were uncovered.
 
Back
Top