Failing Drives

My very first harddrive, that is now long gone, was a 40MB 3.5" ATA drive, before it got known as PATA.

I've since had various types, PATA, SCSI, SATA and the occational SAS.

Right, disregarding that long history, I had a bunch of drives I need to figure if they worked or not. Fortunatey, I also have a motherboard and a cabinet with hotplug drives, which makes the whole ordeal a lot easier.

The way forward is easy enough:

* Plug drives in
* Get some kind of running system up (Using FreeBSD here)
* Initiate long [S.M.A.R.T.][smart]
* Check the result..

* And do the whole thing for all drives :-)

Displaying detected drives

# camcontrol devlist
<ST32000645NS 0004>                at scbus2 target 0 lun 0 (pass0,ada0)
<WDC WD20EARS-00MVWB0 51.0AB51>    at scbus3 target 0 lun 0 (ada1,pass1)
<WDC WD20EARS-00MVWB0 51.0AB51>    at scbus4 target 0 lun 0 (ada2,pass2)
<WDC WD20EARS-00MVWB0 51.0AB51>    at scbus5 target 0 lun 0 (ada3,pass3)

Starting smart long tests

Once you know what drives you've got, smart the smart tests.

# for drive in ada0 ada1 ada2 ada3
do echo "Starting long SMART test on $drive"
smartctl -t long /dev/$drive
done

It'll spit out en estimate of when the drives are done being tested..

Can take quite a while.

Querying the drives

# for drive in ada0 ada1 ada2 ada3 ; do
echo "SMART Result for $drive"
smartctl -q errorsonly -H -l selftest /dev/$drive
done

Bonnie++

Having done the smart tests, or possibly before doing them, I like to create a filesystem on a drive, mount it up and have Bonnie++ run the disks through it's paces. Its default appears to be mostly good enough for my needs to running it is fairly straight forward..

First I make sure I actually have bonnie++ on the machine..

# pkg install -y bonnie++

Then we clean up the old partitions on the drive, here I'm doing it with ada1..

I recommend making absolutely sure that you're messing with the wrong drive, partitioning can be a really sad experience if you partition the wrong media.

# gpart destroy -F ada1

Then create a simple partition

# gpart create -s GPT ada1
# gpart add -t freebsd-zfs ada1

And make a zpool that gets mounted automagically once created.

# zpool create bonnie0 /dev/ada1p1

Then create a directory that's user writeable and run bonnie.

# mkdir /bonnie0/bonnie
# chmod 777 /bonnie0/bonnie
# exit
$ cd
$ sudo camcontrol identify ada1 | sed -e 's/^/# /' >>bonnieresult.csv
$ bonnie++ -d /bonnie0/bonnie -q >>bonnieresult.csv
$ bon_csv2html <bonnieresult.csv >bonnieresult.html

I use the '#' lines to change the system name in the .csv file later where I use:

# device model          ST31500341AS
# serial number         9VS06NRE

To change..

-1.97,1.97,shugin,1,1546344463,4G,,50,97,64545,32,31958,18,131,98,109458,23,184.5,8,16,,,,,9016,70,+++++,+++,10422,96,12042,93,+++++,+++,10170,93,269ms,26242us,363ms,125ms,107ms,323ms,39222us,152us,590us,7202us,933us,8809us
+1.97,1.97,shugin-ST31500341AS-9VS06NRE,1,1546344463,4G,,50,97,64545,32,31958,18,131,98,109458,23,184.5,8,16,,,,,9016,70,+++++,+++,10422,96,12042,93,+++++,+++,10170,93,269ms,26242us,363ms,125ms,107ms,323ms,39222us,152us,590us,7202us,933us,8809us

Haven't done any automation of this since device model seems like it's very free hand for the produceres and it has nultiple names, spaces and other fun stuff..

Then it's a simple matter of making that html file available to a browser. Also, multiple results can easily be store in the csv file and the resulting html file will be a list of benchmarks.

Reading the output from bonnie++ is a whole other matter...

If everything checks out fine, I think this is a good idea, letting smart do it's smart thing regularily.

sudo smartctl --smart=on --offlineauto=on --saveauto=on /dev/ada1

Comments

comments powered by Disqus