Recovering a failing disk using a Raspberry Pi and a bit of AI – Andrew E. Scott
Skip to content
Search for:
Friends and Family
99sauces<br>Favourite foodie site
Bob<br>and Hyun Jeong
Bookmarks
Brad
Brendan
Chris<br>Transport charts
Claire
Guy
Jenny
Kate<br>Combined site with Kate
LinkyLou Photography
Lynn<br>travel blog
Lynn<br>book reviews
Mastodon
Melis
Naina<br>by Aditya
Peter
Phil
Photos<br>My pictures
Recipe Club
Screamstress
TPA<br>Tim & Lynne’s company
Interesting
A VC
Babbling VC
Both Sides of the Table
ChinaGeeks
Consummate Traveller
Feld Thoughts
FlutePrac
Halloween Prank
Hugh Bradlow
jasonbstanding
JWT Intelligence
Lightspeed Venture Partners
Making Hay
Nathan Bell
Only Slightly Bent
PC Thoughts
PointAPointB
Prometheus Ink
RP Data Research
Tatham
terra incognita
The Unconvential Economist
The World According to
Tony
VisionMobile
willdonovan
Pages<br>Recent Comments<br>Categories<br>Archives<br>Contact Details
Andrew<br>E.<br>Scott
Work: +61-417-137-515
Timezone: +11:00
Disclaimer<br>Opinions here are mine and not my employer's.
Site Admin
Host Admin
Log in
If you have a failing hard disk, and it has something really valuable on it (a bitcoin private key, irreplaceable photos, or the only copy of an unpublished book manuscript, for example), you should pay a professional to recover what’s on there. In my case, a relative had asked me if I might try to recover anything I could, and it didn’t matter too much if I couldn’t. This was an interesting challenge.
I didn’t want to spend too much on it, and the drive wasn’t recognised by my MacBook, so I thought I’d try using a cheap Linux computer that I had lying around – a Raspberry Pi Zero 2 W, which I bought originally for about $30. I built a recovery rig and some scripts, as well as tweaked some open source programs, and (spoiler!) in the end I managed to recover their data. Here’s how I did it.
My recovery rig
What I have here may look a bit messy, but it makes some sense once you understand the pieces. It is designed to largely automate the copying of the sectors from the Failing drive (top right) to the Recovery drive (bottom left). Here’s a labelled version:
Starting from the left, we have:
The Raspberry Pi Zero 2 W (running Raspberry Pi OS Bookworm), powered by its own power supply on the powerboard. It is connected to:
A 4-port Raspberry Pi USB 3 Hub, also powered by its own power supply on the powerboard, and which on the lower side of the hub is connected to:
The Recovery drive, namely a 2TB Seagate One Touch Portable Hard Drive, powered by the hub, since the Pi Zero doesn’t pump out much power.
On the upper side of the hub is a USB Y Cable, that passes through data from the hub, but gets power from a different USB cable. This different USB cable is connected to a power supply on:
A TP-Link Tapo P100 smart plug (more on this later). This smart plug has a double adaptor, supporting the power supply for the USB Y Cable, and also the power supply for:
A Digitech Computer XC4150 SATA/IDE to USB 2.0 Hard Drive Adaptor, using a JMicron USB to ATA/ATAPI bridge chip, connected to the hub with the USB Y Cable, and itself is connected to:
The Failing drive, namely a 1TB Seagate Barracuda SATA 3.5″ Internal Hard Drive.
By using the USB Y Cable, and having its power supply on the same Tapo P100 smart plug as the power supply for the USB SATA adaptor, all sources of power to the adaptor can be turned off and on remotely via commands from the Raspberry Pi. The ability to do a power cycle was important in the recovery process, as often the Failing drive would get into a broken state, and only a power cycle was able to get it working again. Even the small amount of power going via the powered hub and the USB cable to the adaptor was enough to prevent a proper power cycle, so this power had to be turned off also. The Raspberry Pi USB 3 Hub is a relatively cheap hub, and does not have per-port power switching, which might have been an alternative option.
In case this is still confusing, here’s a diagram that may help:
In addition to the recovery rig, I also used a MacBook Air M1 laptop (running macOS Tahoe) to drive a bunch of the automation.
Raspberry Pi and Tapo P100 configuration
A critical aspect of the Raspberry Pi is that it was a Raspberry Pi Zero 2 W, with the "W" indicating that it supports Wi-Fi. The Wi-Fi was critical to allow my MacBook to control the Pi, but also for it to control the TP-Link Tapo P100 smart plug.
The Tapo P100 smart plug can be set up to be controlled by the Pi directly. Firstly, set up the P100 smart plug normally using the Tapo app, and once you can turn the plug on and off from the app (i.e. it’s working), go into the Me section of the app, select the Third-Party Services settings, and turn on Third-Party Compatibility. Also tap on the smart plug, tap the cog icon, and under Device Info you should be able to see its IP address. Note this down for later.
The Pi also needs some...