1

I have a damaged HDD that I'm trying to image.

I connected it using an external USB to SATA cable to my pc, and here is the issue, it is damaged, so after I'm reading a few bytes from it, it becomes unavailable, basically it freezes, until I manually remove the usb and plug it back in, then I can read a few more bytes from it until it freezes again.

I figured that if I can somehow automate the restart process, that right now can only be done by me physically unplugging the usb cable, I can slowly image the entire drive (or at least enough that I can recover my fiancee's most important files).

I've been looking for a way to cut off power to the usb, in order to incorporate it in a script that uses dd to image the drive into a file, but things like

echo "0" > "/sys/bus/usb/devices/usbX/power/autosuspend"
echo "auto" > "/sys/bus/usb/devices/usbX/power/level"

(from Controlling a USB power supply (on/off) with Linux)

didn't work.

Is there still a way, using any language, to turn off power to a usb port from linux?

Tom Klino
  • 2,358
  • 5
  • 35
  • 60
  • Not sure if this can help but look here: https://unix.stackexchange.com/questions/234581/disconnect-and-reconnect-usb-port-via-cli also look at the link in the first comment of that post – walkman Jun 17 '20 at 18:37

0 Answers0