[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dd - proper use or more suitable program



On 11/12/2016 1:31 AM, Christian Seiler wrote:
On 11/11/2016 10:38 PM, Richard Owlett wrote:
I was wondering about that.
https://www.gnu.org/software/ddrescue/manual/ddrescue_manual.html is
not first time user friendly. Will re-read after a good night's
sleep. Will also look for appropriate tutorials. Suggestions?

Well, I would suggest not dumping the result on another partition
but rather into an image file. In that case you'd have the old
drive (not mounted), let's call it /dev/sda, and the new drive
with a partition on it and mounted on /mnt with sufficient free
disk space there.

In the simplest case you'd do:

ddrescue /dev/sda /mnt/defective_drive.img /mnt/defective_drive.log

If the drive is farther gone and has quite a few defective
sectors you may get better results if you use direct disk access
for the phase where you try to read defective sectors. In that case
you'd copy the bulk of the data while disabling the scraping phase
manually,

ddrescue -n /dev/sda /mnt/defective_drive.img /mnt/defective_drive.log

And then use direct access to scrape the rest:

ddrescue -d /dev/sda /mnt/defective_drive.img /mnt/defective_drive.log

Note that ddrescue assumes a default sector size of 512 bytes,
which is likely to be correct for older hard drives smaller than
2 TiB. If you have a newer hard drive, especially if it's rather
large, the physical sector size could be 4096 bytes instead.
(You can check the physical sector size of your disk by running
hdparm -I /dev/sda - that will tell you a lot of things about
your drive, among them the physical sector size in bytes. Note
that the physical sector size is relevant here, not the logical
one.)

In addition, you may also want to specify a number of retries
when trying to read defective sectors. (Default is 0.) You can
do that with the -r flag, e.g. -r3 for three retries per sector.

To recap:

  - Simplest way of calling the program is

    ddrescue /dev/sda output_image_file log_file

  - If the condition of your hard drive is a bit worse, you might
    achieve better results with:

    ddrescue -n /dev/sda output_image_file log_file
    ddrescue -d -r2 /dev/sda output_image_file log_file

    (-r2 is for 2 retries per defective sector, you can change
    that number; you can also call the second ddrescue command
    again in case you want to do more retries.)

  - If you have a new disk with 4096 bytes / sector (not likely)
    please also add a -b4096 to the command line.

  - If your target is not an image file, but a disk drive itself,
    also specify the -f option. (I would really recommend using
    image files though, gives you more flexibility.)

  - I wouldn't really bother with the other options, the default
    behavior is very sensible.

  - Finally, get some coffee or similar, this may take a while.

Regards,
Christian

Your timing is perfect. Couldn't sleep so just finished reading a couple of tutorials. Your post filled some holes. You also confirm my tentative choices of options. Now to go back to bed.



Reply to: