Skip to content

Instantly share code, notes, and snippets.

@MDeiml
Created July 29, 2023 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MDeiml/9a83bbd11f3b075a71b8313787c5c7c0 to your computer and use it in GitHub Desktop.
Save MDeiml/9a83bbd11f3b075a71b8313787c5c7c0 to your computer and use it in GitHub Desktop.
ddrescue -- power drive off and on after every slow read
#!/bin/bash
DRIVE=sda
IMAGE=
MAPFILE=
until ddrescue /dev/$DRIVE $IMAGE $MAPFILE -n -a 10M --max-slow-reads=0
do
sleep 5
echo "turning off $DRIVE"
echo 1 >/sys/block/$DRIVE/device/delete
sleep 5
echo "turning on $DRIVE"
echo "- - -" >/sys/class/scsi_host/host0/scan
sleep 5
done
@MDeiml
Copy link
Author

MDeiml commented Jul 29, 2023

Not tested yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment