M
Mindfulness
Guest
To reduce errors in running ddrescue, I wrote a script that takes most of my human typos out of the equation. I am actually better with the command line then most linux guis. The command line works on virtually all forms of linux the same.
This following procedure works best for us. We like to backup our data recovery drives to an image file. We can have multiple images on a large 2tb drive. This script runs a preferred 2 pass method of ddrescue. The first run is a quick pass without splitting blocks or retries. the second run splits blocks and retires 3 times
To run the script, you will need to know your hard drive device name. The easiest way to get it is to run the following command twice. once before plugging in your hard drive and once after plugging in your hard drive. first we will run the following command before plugging in our drive we need to recover
next we plug in the drive, wait a minute, than run the command again
in this example the new drive is sdg so our drive name is /dev/sdg (it is /dev/ + sdg)
now that we know the drive name we run the following script
in the script you need to set your image location one time. Every time you run the script it will ask you the device name of your hard drive to recover and the name you want to save your image as.
This following procedure works best for us. We like to backup our data recovery drives to an image file. We can have multiple images on a large 2tb drive. This script runs a preferred 2 pass method of ddrescue. The first run is a quick pass without splitting blocks or retries. the second run splits blocks and retires 3 times
To run the script, you will need to know your hard drive device name. The easiest way to get it is to run the following command twice. once before plugging in your hard drive and once after plugging in your hard drive. first we will run the following command before plugging in our drive we need to recover
Code:
root@linuxbox:~# ls /dev | grep sd
sda
sda1
sda2
sda5
sdb
sdc
sdd
sde
next we plug in the drive, wait a minute, than run the command again
Code:
root@linuxbox:~# ls /dev | grep sd
sda
sda1
sda2
sda5
sdb
sdc
sdd
sde
sdg
sdg1
sdg2
sdg3
in this example the new drive is sdg so our drive name is /dev/sdg (it is /dev/ + sdg)
now that we know the drive name we run the following script
Code:
#!/bin/sh
#please change the value of IMAGE_DIR= to the location where you want to save your images
IMAGE_DIR=/images
echo please enter the device you want to clone ex. /dev/sde:
read HD_DEVICE
echo please enter a name to save your image as:
read IMAGE_NAME
echo
echo running the following command:
echo ddrescue -n $HD_DEVICE $IMAGE_DIR/$IMAGE_NAME $IMAGE_DIR/$IMAGE_NAME-log
ddrescue -n $HD_DEVICE $IMAGE_DIR/$IMAGE_NAME $IMAGE_DIR/$IMAGE_NAME-log
echo
echo running the following command:
echo ddrescue -r3 -d -f $HD_DEVICE $IMAGE_DIR/$IMAGE_NAME $IMAGE_DIR/$IMAGE_NAME-log
ddrescue -r3 -d -f $HD_DEVICE $IMAGE_DIR/$IMAGE_NAME $IMAGE_DIR/$IMAGE_NAME-log
in the script you need to set your image location one time. Every time you run the script it will ask you the device name of your hard drive to recover and the name you want to save your image as.
Last edited by a moderator: