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 smartctl and hdparm. On Debian or Ubuntu, use this command: sudo apt install smartmontools hdparm. The dd tool 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:

  1. Identify. I diff lsblk against this baseline to find the new disk. I tell you the model and size so you can confirm it’s the right one.
  2. 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”).
  3. Read speed. I run hdparm -t and a large sequential dd read with direct I/O. This is non-destructive.
  4. 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.
  5. 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:

DiskSizeWrite (MB/s)Read (MB/s)SMARTVerdict
WD40NDZW4 TB7875–114CleanGood
WD20NMVW2 TB8557–1151 reallocated sectorGood. Watch it.
WD20NMVW2 TB6947–101CleanGood
WD40NMZW4 TB557–98CleanBad. Do not use.

I tested seven disks. Six went into the good bin. One went into the bad bin.

Drawing of two bins. The good bin holds a pile of six smiling hard disks. The bad bin holds one sad hard disk.

PNG version

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.

Bar chart of the write speed of seven hard disks. Six disks wrote at 64 to 85 megabytes per second. One disk wrote at 5.

PNG version

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.

Bar chart of a hard disk and an SSD. The hard disk writes at about 77 megabytes per second and reads at about 95. The SSD writes at 880 at first, then at 153 when its cache is full. The SSD reads at about 450.

PNG version

Fun fact: How long does a backup of 1 TB take? The chart shows the time at the speeds I measured.

Bar chart of the time to back up 1 terabyte. A hard disk needs about 3 hours 36 minutes. An SSD needs about 1 hour 18 minutes.

PNG version

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.

Linear chart of disk bandwidth in megabytes per second, from 0 to 1,000. Hard disks are near 100. The SSD is between 150 and 900. The limits are: USB 2 about 40, USB 3 about 450, SATA III about 550, USB 3.2 about 1,000. NVMe is about 7,000 and is not on the chart.

PNG version

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:

  1. Write one big file of known data to the free space of the SSD.
  2. 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.

StepSpeed
Write, first 320 GiBabout 890 MB/s
Write, after the fast cache was fullabout 130–180 MB/s
Read back and compareabout 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.

Time chart of SSD speed. Write speed is about 890 megabytes per second for the first 6 minutes. It then drops to 130 to 180 for about 2.4 hours. The read-back phase runs at 440 to 500 for about 1 hour.

PNG version

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.