ddrescue -f -n -u -R /dev/sda /dev/sdb logfile
###Here’s how the options break down
- -f: “Force” option. Required when ddrescue is writing to a device (healthy drive) rather than a file.
- -n: “No Scrape” option. Avoids deep recovery of bad sectors/file data, which is very useful when doing a single-pass, fast recovery. You can, of course, use the logfile to do a deeper recovery after the first pass is done.
- -u: “Unidirectional” option. Runs all passes in the same direction, which is relevant to the next switch . . .
- -R: Will run the recovery backwards as you’ve said you wanted.
- /dev/sda: The failing source drive. Before starting the operation, you’ll need to make certain that the drive is unmounted (the OS recognizes it, but it’s not in an active and browsable state). See below for details.
- /dev/sdb: The drive you’re about to rescue/clone /dev/sda to. Also needs to be unmounted.
- logfile: The location and name of the logfile that will be generated during ddrescue’s run. Consider this to be necessary, even if you don’t run any additional passes. It’ll allow you to resume recovery where you left off if the process is interrupted.
###On drive names and detection
Since Parted Magic runs in a Linux environment, you’ll need to be able to ID each drive – the failing one and the new one – using Linux command-line tools.
fdisk -l will give you a list of the drives the OS sees and their partition info (if any); e.g., the following shows the info about two recognized drives on my system – /dev/sda, which has 4 partitions, and /dev/sdf (a thumbdrive), which has 2 partitions. When doing whole-drive recovery, the important info for ddrescue is the Disk name (/dev/sda). The partition information (/dev/sda1, /dev/sda2, etc) is irrelevant:
[b@asusi7 Downloads]$ fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x000d35e8
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 120002047 120000000 57.2G 83 Linux
/dev/sda2 120002048 360002047 240000000 114.5G 83 Linux
/dev/sda3 360002048 1889521578 1529519531 729.3G 83 Linux
/dev/sda4 1889521579 1953520064 63998486 30.5G 83 Linux
Disk /dev/sdf: 3.7 GiB, 4004511744 bytes, 7821312 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6b87f50d
Device Boot Start End Sectors Size Id Type
/dev/sdf1 * 0 917503 917504 448M 0 Empty
/dev/sdf2 244 8435 8192 4M ef EFI (FAT-12/16/32)
It’s been a while since I’ve used that distro, but Parted Magic shouldn’t automatically mount any drives unless you run an operation that requires it (such as trying to browse the drives’ contents). To see if anything’s been mounted, use the df -l command. Any entries returned that use a partition path for the drives found using fdisk -l will need to be unmounted using the umount command (note the lack of an ‘n’ after the first ‘u’) before starting ddrescue:
[b@asusi7 Downloads]$ df -l
Filesystem Size Used Avail Use% Mounted on
dev 7.9G 0 7.9G 0% /dev
run 7.9G 1.2M 7.9G 1% /run
/dev/sda1 57G 14G 40G 26% /
tmpfs 7.9G 16M 7.9G 1% /dev/shm
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
tmpfs 7.9G 60K 7.9G 1% /tmp
/dev/sda2 113G 57G 51G 53% /home
/dev/sda3 718G 227G 455G 34% /media/Storage
tmpfs 1.6G 28K 1.6G 1% /run/user/1000
/dev/sdf1 448M 448M 0 100% /run/media/b/VOID_LIVE
Using the above results, if I wanted to recover /dev/sda to /dev/sdf, I’d need to unmount each of the partitions listed that exist on those drives before starting:
umount /dev/sda1
umount /dev/sda2
umount /dev/sda3
umount /dev/sdf1
###One more thing . . .
If you’re running a full-drive recovery, you need to make certain that the replacement drive is the exact same size as the source drive.
Hope this helps.