Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Does anyone have any ideas about how to set up automatic detection and conditional formatting of a LOT of HDDs?

I tried posting this on TomsHardwareForums, but I don't think the responder read my question.

Anyway, I would like to try to set up some kind of a linux system for testing these drives. If any grizzled HDD savvy linux admins here have experience with this, I would love a pointer or two.

I'm currently running CentOS on some old hardware and using a USB interface to a hot swap bay for testing these, but it's not really an ideal solution.

I'd like to assign each bay to a specific /dev location, and use modprobe to automatically detect the drives, check whether they pass the SMART test (and whether they have prefail values that indicate further testing), format them or DoD wipe them if they have data on them, then indicate this status somewhere for easy removal. I have this about half-way done, so far. I've heard good things about ldadm.

P.S. The link to my post on tomshardwareforum follows : http://www.tomshardware.com/forum/336332-31-automatically-testing-formatting-multiple-hdds-masse

share|improve this question
add comment

1 Answer

I'm currently running CentOS on some old hardware and using a USB interface to a hot swap bay for testing these, but it's not really an ideal solution.

A USB-to-SATA adapter probably won't work for this, because they usually don't allow you to run SMART commands. I'd use SATA directly for this.

If that's not an option, you will need a USB-to-SATA adapter with ATA pass-through support: http://sourceforge.net/apps/trac/smartmontools/wiki/Supported_USB-Devices

I'd like to assign each bay to a specific /dev location

The symlinks in /dev/disk/by-path may be helpful for this.

check whether they pass the SMART test (and whether they have prefail values that indicate further testing)

Use SMART selftests for this:

smartctl -t long /dev/sdX

format them or DoD wipe them if they have data on them

Use ATA Secure Erase: https://ata.wiki.kernel.org/index.php/ATA_Secure_Erase

share|improve this answer
    
I'd go with badblocks -w -t random to wipe and test a HDD for bad blocks. (Wow, old question...) –  frostschutz Sep 17 '13 at 10:57
    
The selftest feature of smartctl has IMO several significant advantages: 1) the result is permanently logged to the hard disk and can always be queried with smartctl -a. Even if you format the hard disk, the result shouldn't be lost. 2) Also it has proven to be a 100% reliable to me - I've never seen it misdiagnose a hard disk, and we're using it on several hundred servers. 3) It works in the background and can be started on running disks with mounted filesystems, and it won't destroy any data. –  Martin von Wittich Sep 17 '13 at 12:16
1  
Yes, sure, but I'd still do it in addition to that. The selftest does not test writing, nor would it detect problems closer to the SATA side of things. As for the secure erase, it's a black box you can either trust or not (strictly speaking, badblocks -t random is not random enough for that either). –  frostschutz Sep 17 '13 at 12:26
    
"nor would it detect problems closer to the SATA side of things" - that's an extremely good point. I'd consider this both an advantage and a disadvantage of SMART selftests - if the test results in an error, you know for certain that the error is inside the hard disk and cannot be caused by the controller or the cable. On the other hand, when the test succeeds you haven't ruled out controller or cable failure. I'd say though that OP is explicitly looking for a test of the hard disk and not of his setup, so selftests suit his case fine. –  Martin von Wittich Sep 17 '13 at 13:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.