I turned a Raspberry Pi into an automatic onerous drive testing station that messages my cellphone

I bought uninterested in randomly discovering out a tough drive I believed was good wasn’t really good, so I constructed a software to mechanically benchmark and take a look at my drives earlier than I belief them with my knowledge. Here’s what I constructed and the way you should use it to make your homelab extra dependable.
Why I benchmark and take a look at drives earlier than trusting them
Just as a result of it labored prior to now doesn’t suggest it is dependable now
As somebody who’s reviewing computer systems, NAS techniques, servers, and different homelab tools lots, I’ve numerous onerous drives. The factor is, that is probably not a change for me. I’ve always had a lot of hard drives around, whether or not they got here from an previous system, have been utilized in an previous NAS, or have been one thing I just lately picked up.
Hard drives aren’t at all times straightforward to know in the event that they’re good or not. I just lately had a drive that was high-quality for a few years, and after shutting a server down for a number of weeks, the drive powered up and was dangerous. Did it magically go dangerous in these few weeks? Probably not, however once I offered that server, I examined the drives that have been in it and located one was dangerous — that is why you at all times take a look at a drive.
Just a few months in the past, I bought a number of 20TB drives from a good friend who was promoting them. When they arrived, I instantly threw them into my NAS as a result of I used to be excited to have larger-capacity drives.
Two drives labored, two did not. I wasn’t certain if it was my NAS performing up, in the event that they weren’t seated proper, or what was happening. Eventually, I discovered two of the drives have been broken in transit.
So, after these situations, I’m engaged on making it a behavior to check drives earlier than utilizing them now, simply to verify they have not failed. However, it is a problem to tug my drive dock out of the closet, plug it in, dock the drive, after which manually run a scan. So, I constructed a software that might deal with all of it for me, headless and on a Raspberry Pi, known as DriveCheck.
All it takes is a Raspberry Pi and a USB HDD dock
The software program does the remainder
So, as an alternative of lugging out {hardware} each time I wished to check a tough drive, I made a decision to construct a devoted docking station. The nice half is it is simply primarily based on a USB onerous drive dock and a Raspberry Pi.
Right now, the Pi is hardwired into my community simply because it is shut sufficient to be. However, I can simply take and transfer the Pi anyplace it has energy and run it wirelessly.
DriveCheck is constructed merely. DriveCheck deploys by way of a single installer file that units every part up for you. I selected to not go the Docker route as passing by way of completely different drives mechanically with Docker is a little bit of a headache.
I constructed DriveCheck to have each an internet dashboard and a Telegram bot agent. You merely provide the Telegram bot credentials (or Discord webhook, however Telegram has extra options) if you wish to use that.
The net dashboard is the place every part lives, and it runs on port 8765 by default. You can configure DriveCheck utilizing both command line arguments or within the net dashboard.
Once configured, it displays for any onerous drive to be docked into the USB dock. It ignores drives that are natively mounted to the system for safety functions, so you may’t by accident wipe your boot drive.
I’ve mine configured to be 100% headless, although you do not have to set it up that manner. This implies that once I dock a drive into the system, I get a Telegram notification when a scan begins and finishes. Telegram additionally has built-in buttons for different actions, like working an prolonged take a look at or formatting. There’s additionally a button to eject the drive, although that occurs mechanically after a configurable period of time.
I constructed the software program to be a check-first software. That implies that the primary purpose of the software program is to easily examine and benchmark the drive. So, once I dock a drive, it begins by running a short SMART test, then runs a learn pattern to measure the hooked up drive’s learn pace.
Then, I can begin an prolonged take a look at if I need to dig deeper into the drive. Typically, a brief take a look at with a learn pattern is sufficient for me. There are additionally two format choices. Quick erase is just like Windows’ Quick Format software, however you may also fully overwrite the drive or use the drive’s firmware to format it if you would like.
Overall, this software has made scanning onerous drives very simple as an alternative of the cumbersome course of it was once.
A passing end result provides me place to begin
It’s nonetheless not a assure, although
As I mentioned, I primarily give attention to the short take a look at. It helps me take a look at a drive’s learn speeds and run a brief SMART take a look at. This sometimes signifies whether or not a drive is wholesome. However, it’s not a guarantee in any respect.
So, that is why I embrace the prolonged take a look at. The motive I do not sometimes run that’s that it could possibly take a number of hours, typically over 24 hours, relying on the dimensions of the drive. I solely run an prolonged take a look at if I’m nervous a couple of drive’s reliability.
However, if the drive comes again good with the short take a look at and the learn pace take a look at, then I’ll usually simply roll with it. That provides me place to begin and helps me know what is going on on with the drive.
On the net dashboard, I’ve additionally designed DriveCheck to indicate a number of the SMART outcomes at a look. You can export the total uncooked SMART output if you wish to dig deeper, however the most important metrics are shown at a glance for each drive.
- Compatible Devices
-
2.5- and three.5-inch drives
- Brand
-
SABRENT
- Transfer fee
-
10Gb/s
SABRENT’s USB-C onerous drive docking station is the right technique to entry a HDD or SSD out of your laptop. It is a powered station, that means it helps each 2.5- and three.5-inch drives. Plus, being USB-C, it could possibly simply plug into any machine you already personal.
Checking your drives earlier than mounting them is an effective way to avoid wasting your self a headache
If I had had a system like this in place once I bought these 20TB drives in, then it might have made issues a lot simpler. Instead, I spent many, many hours debugging them. Now, I haven’t got to anymore — and neither do you.
