Why
My backups were slow. I did not know if the cause was the disk, the cable, or the USB port. I wanted a measurement, not a guess.
Then and Now
Before coding agents, I would have spent hours to learn and run disk benchmarks.
Now I use a coding agent. I asked Claude to measure the disks. Claude made a plan to test many disks. Claude tested each disk when I plugged it in.
This article shows the prompt, the results, and the takeaways. The method works for any disk, for example a backup disk, an external SSD, or a spare drive.
Setup
- Linux Mint 22.2 with Claude Code.
- Install
smartctlandhdparm. On Debian or Ubuntu, use this command:sudo apt install smartmontools hdparm. Theddtool is part of the standard Linux tools. - Plug in one disk at a time. Each disk takes 10 to 15 minutes.
The prompt, and the plan it produced
I did not write a long prompt. This is the complete text that I typed, with the spelling errors:
measuring disk performance
ok I am sick of slow disks..
I want to check a few disks to see how good they are..
I am going to plug them one by one..
you are goint to test them.
sounds good?
Claude Code replied “Sounds good”. It listed the installed tools. It listed the attached disks. Then it proposed this plan:
- Identify. I diff
lsblkagainst this baseline to find the new disk. I tell you the model and size so you can confirm it’s the right one.- Health. I run
smartctl -a, checking reallocated and pending sectors, power-on hours, error log and negotiated link speed (USB 2 vs USB 3 is a common cause of “slow”).- Read speed. I run
hdparm -tand a large sequentialddread with direct I/O. This is non-destructive.- Write speed (optional). I only do this if you OK it. On a mounted filesystem, I write and delete a temporary 4 to 8 GB file, which is safe. On a raw disk whose data you don’t need, I do a full-surface test. That is destructive, so I’ll ask first for each disk.
- Sustained speed. Many SMR drives and cheap SSDs are fast for the first minutes and then collapse. If a disk looks suspicious, I’ll run a longer write to catch that.
Plug in the first disk when you’re ready and tell me. Also tell me whether it holds data you care about, so I know whether destructive tests are allowed.
The plan changed during the session. The write test became a fixed test of 150 seconds. Claude Code recorded the write speed every 15 seconds. This is the final version of the prompt. Paste it into Claude Code to save time. Claude Code does not do a destructive write before it asks you.
I'm going to plug in disks one at a time and want you to measure the performance of each. For every disk:
1. Detect the new disk by diffing lsblk against the baseline. Tell me the model, serial and size, and don't touch disks that were already attached.
2. Check health: smartctl -a -d sat (reallocated, pending, CRC errors, power-on hours, temperature, error log) and the USB link speed (it should be 5000 Mbps or more).
3. Run read tests, non-destructive: hdparm -t, plus dd iflag=direct samples at the start, middle and end of the disk. If any region is slow, re-test it and map its extent.
4. Run a write test on the mounted filesystem: a 150 s time-limited dd of /dev/urandom with oflag=direct, logging MB/s every 15 s to catch SMR slowdowns. Use sudo if the volume is root-owned, delete the temp file afterwards and confirm it's gone. If the disk is locked, ask me to unlock it. Never do destructive raw writes without asking me first.
5. Report a short table (SMART, age, temperature, read range, write MB/s, verdict) and keep a running scoreboard across disks.
Flag anything suspicious: reallocated or pending sectors, a flat-then-collapsing write curve (likely SMR), or slow regions. Then wait for me to plug in the next disk.
Plug in a disk, then tell Claude
Type “plugged in the next disk”. Claude Code does the same checks each time. At the end, it shows a table of results and a scoreboard. Two points matter:
- Claude Code identifies each disk by its serial number. Linux can use the same name for different drives, for example
/dev/sdd. Make sure that the serial number is for the right disk. - Claude Code does not type your passphrase. If a disk needs a passphrase, Claude Code asks you to unlock it. Then it does the write test and deletes the temporary file.
Results
Claude Code shows one table row for each disk. This is an extract:
| Disk | Size | Write (MB/s) | Read (MB/s) | SMART | Verdict |
|---|---|---|---|---|---|
| WD40NDZW | 4 TB | 78 | 75–114 | Clean | Good |
| WD20NMVW | 2 TB | 85 | 57–115 | 1 reallocated sector | Good. Watch it. |
| WD20NMVW | 2 TB | 69 | 47–101 | Clean | Good |
| WD40NMZW | 4 TB | 5 | 57–98 | Clean | Bad. Do not use. |
I tested seven disks. Six went into the good bin. One went into the bad bin.
This chart shows the same batch of tests. The shaded area shows the healthy range in my batch. One disk is far outside this range.
HD vs SSD
The SSD wrote and read much faster than the hard disks. But its write speed fell when its fast cache was full. The SSD is a no-name brand, so other SSDs can be faster or slower.
Fun fact: How long does a backup of 1 TB take? The chart shows the time at the speeds I measured.
Disk bandwidth on a scale
This chart shows the speeds against the limits of each interface. A faster disk does not help if the disk is near the limit of its USB or SATA interface.
The interface values are approximate limits for real use. The NVMe value comes from the manufacturer specification. I did not measure it.
Is the SSD lying about its capacity?
A speed test does not show every problem. Some cheap SSDs report more capacity than they have. They accept the writes, then return wrong data later. Because my SSD is a no-name brand, I asked Claude to fill its free space and check every byte.
The test had two steps:
- Write one big file of known data to the free space of the SSD.
- Read the file back and compare it with the data that Claude wrote.
Result: pass. Claude read back all 1,603 GiB and the data was identical. There were no write errors and no read errors.
| Step | Speed |
|---|---|
| Write, first 320 GiB | about 890 MB/s |
| Write, after the fast cache was full | about 130–180 MB/s |
| Read back and compare | about 440–500 MB/s |
The chart shows the speed of each 64 GiB step over time. The write speed fell after 6 minutes, when the cache was full. It stayed low for the rest of the write, which took about 2.5 hours. The read speed stayed steady.
What this test does not show: The SSD has 3.6 TiB of capacity, and my backups already used 1.9 TiB. The test wrote only to the free space. Claude did not overwrite the used space. The pass covers the free space only. It does not prove that the full 4 TB is good.
Takeaways
- Describe the goal. Let Claude make the plan. A few lines were enough. Claude proposed the tests. I only plugged in the disks.
- Make the tests safe. Do the read-only tests first. Identify each disk by its serial number. Do not allow a destructive action without a clear yes.
- Trust the results, but test again. Record the write speed over time. Repeat each unexpected result. Compare each disk with your other disks.
- A speed test does not prove that the data is safe. Write known data, read it back, and compare it.
A note on how I made this article: I use AI tools to help create this blog. The ideas and the experiments are mine. The AI helped me run the tests, make the charts, and write the draft. I decided what to test and what to say.
Loading comments…