1

I'm using a program called badblocks to scan disks for errors, and I'm finding that it sometimes appear to get stuck in a loop. I'm using in read/write mode and by default it tests four patterns. Here's an example:

badblocks -w -s /dev/sdf -b 4096

Testing with pattern 0xaa: done                                                 
Reading and comparing: done                                                 
Testing with pattern 0x55: done                                                 
Reading and comparing: done                                                 
Testing with pattern 0xff: done                                                 
Reading and comparing: done                                                 
Testing with pattern 0x00: done                                                 
Reading and comparing: 1.79% done, 23:39:29 elapsed. (0/0/0 errors)

Okay, looks good, except that this is now the third time it's done the final pattern (0x00). When it reaches 100% it just resets the % counter and starts over. This job is not currently running, but I'm now running bad blocks on another machine with another disk, and I've noticed that it's repeating the second pattern. Any ideas? In both cases no errors are reported (so far).

4
  • Sounds mysterious. You're not using the num passes option through an alias? Which platform, distro, version of badblocks/e2fsprogs, size of target device…? Can you reproduce it with a ramdisk or tmpfs loop device or smaller partition? Commented Feb 15, 2023 at 0:06
  • Both machines are gentoo linux, one is a dell optiplex (pretty standard desktop) and the other is a banana pi. I have run badblocks on other drives on both machines with the same command as typed, without issue. Actually, the drive currently in the BPI that's giving me the problem was previously scanned by the desktop without issue. Commented Feb 15, 2023 at 4:32
  • I superficially checked the badblocks source code, the "Testing with pattern" loop and the "Reading and comparing" loop are near about copy-pastes of each other, if one has a bug that allows repeats then the other should too. More exotic would be a compiler bug, a misbehaving terminal leading to misinterpreting output, or whatever. Maybe you can grab a badblocks binary from another distro and see if you can still reproduce it with that. Commented Feb 15, 2023 at 9:03
  • frostschutz, that's a good idea. Replicating the bug might take some effort since I've not noticed a pattern as to when it gets stuck. Currently the BPI is still stuck on the second pattern. Commented Feb 16, 2023 at 5:24

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.