_thebrain_, (edited )

You should be able to use smartctl on a USB drive. I’ve never had an issue anyway. You may need to specify the transport type tho. I had a drive that it couldn’t figure out on its own, but since it was an sata drive in an external enclosure, atapi is the transport protocol to use

sudo smartctl -a -d ata /dev/<devid>

Using the same switch you can run a long test. It’s sort of a pain as it will kill the test on finding a bad sector. But you can take that sector number and plug it into hdparm to rewrite the sector hoping it will remap it. You won’t be able to recover the data in a bad sector, But There are these extra sectors on the drive that firmware can replace the bad one with. It does this on a forced write command.Something along the lines of

hdparm --repair-sector --yes-i-know-what-i-am-doing </dev/<driveid> <sector number from smartctl>

Again, you have data loss, you can’t go back to no loss. All you can do is rescue anything important. You may (probably) need to run a long smartctl test again, and fix another sector. I have saved data off of drives with 100+ bad sectors this way… It’s tedious and eventually I scripted it but it does work.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • everett
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • GTA5RPClips
  • khanakhh
  • Youngstown
  • Durango
  • slotface
  • rosin
  • ethstaker
  • kavyap
  • thenastyranch
  • mdbf
  • JUstTest
  • osvaldo12
  • tacticalgear
  • modclub
  • cisconetworking
  • ngwrru68w68
  • Leos
  • cubers
  • tester
  • normalnudes
  • megavids
  • anitta
  • provamag3
  • lostlight
  • All magazines