1

I'm trying to ddrescue (through rescueCD) a drive, which keeps spinning down. e.g

ddrescue -N -n -A -M -f /dev/sdk /dev/sdd mapfile

Without rebooting I can get the drive for a short while through

echo "- - - " > /sys/class/scsi_host/host11/scan

I was hoping to 'watch' that command to run recurrently (bad idea?); but it will occasionally put the drive onto a new /dev/sdX. e.g. from sdf to sdg

Is there some way to force it so keep the same /dev/sdX? In a similar way to how you'd mount a partition through UUID, but for the drive. NB This won't be permanent solution, just for the rescue.

Or, is there some better way to refer to the drive that won't change? Fdisk gives and identifier which doesn't seem to have changed last time, is this a UUID for the disk?

Disk identifier: A9F95F28-4E6C-4ADB-B618-E9C68D96BFEC

Trying

ddrescue UUID=A9F95F28-4E6C-4ADB-B618-E9C68D96BFEC /mnt/rescue/testdd.image mapfile 

ddrescue: Both input and output files must be specified.
Try 'ddrescue --help' for more information.
zsh: no such file or directory: /mnt/rescue/testdd.image

Seems to suggest it's not recognising the UUID, but could be something else.

Other suggestions very welcome! Thanks in advance.

Very much out of my depth (new to linux) and am googling further (udev, wwns) but drowning, badly.

  • 2
    Try using one of the /dev/disk/by-* symlinks to your drive instead of /dev/sdX. The more interesting question is of course why it does spin down. Misconfigured /etc/hdparm.conf? What does dmesg say? – dirkt Apr 24 '17 at 6:17
  • /dev/disk/by-id should be unique for each disk. Not all disks create links in /dev/disk/by-uuid for the whole disk. – ridgy Apr 24 '17 at 10:39
  • 1
    Apologies for delay, just to confirm that ddrescue takes the /dev/disk/by-id ok. @dirkt - drive spinning down as it's on it's way out but thanks for giving me the hdparm to look at. Thanks for the help, I'll accept Giles' as his was an answer, rather than comment, but new here so please tell me if that's wrong. – beardedfool Apr 26 '17 at 0:00
3

As already noted in comments, you can find a reproducible path in /dev/disk/by-id (based on the device's manufacturer and serial number) or in /dev/disk/by-path (based on the port that the device is plugged in).

Although you can use these to create udev rules to force a specific drive letter, it isn't worth the trouble for a temporary setup like yours.

Note that restarting in software may not work so well. When a disk is dying, it usually helps to unplug it, let it rest for a few minutes and run ddrescue again.

  • Accepting as answer. Wondering whether a link to creating the udev rules may help someone else but works for me, cheers. Again, new here, so apologies if that's wrong to ask. Re: Restarting the drive. The mapfile does seem to have an error, not sure if this was restarting or something else but in case it's useful to others. Cheers. – beardedfool Apr 26 '17 at 0:03
  • @beardedfool I added a link to a prior thread on that topic. – Gilles Apr 26 '17 at 0:13
  • For using udev, see also askubuntu.com/questions/882278/… – ridgy Apr 27 '17 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.