Clear all

Is there a terminal command to copy all files on a damaged external drive to a new external drive?  



I have a damaged hard drive (external WD 4TB Passport). I've tried using CCC and the finder to copy the files over to a new drive now that I have managed to mount it(unsuccessfully). I was thinking using the terminal (copying block by block instead of each file?) might accomplish the desired outcome of having the usable data on a working drive, but I'm not sure if my thought process is correct, or if this is possible.

This topic was modified 2 years ago by [email protected]
2 Answers

I'm pretty confident that Finder is a useless option in this scenario - as it craps out as soon as it gets any error.

CCC is my usual choice for this because it will at least copy all the files that are readable and then give a list of errors for the files it couldn't read.

Otherwise my next tool is Disk Warrior - which in my experience seems to do some under the hood manipulation of the mounted drive such that errors are more likely to be suppressed (ie. the read operation retries rather than fails).

Beyond that - there may be other 3rd party apps?


Block by Block copy would be the 'dd' command (man dd).

dd if=/Volumes/damaged_external of=/Volumes/good_external bs=262144 conv=noerror

The bs=262144 is the read/write size of 256K.  you can play with that if you like.  If you have individual damaged sectors you might lose 256K if just one 512byte sector is bad in that range.  But trying to copy 4TB in 512-byte chunks will take forever.  As it is copying in 256K chunks will take awhile.

NOTE:  If the file system is corrupt, that is to say, the file system metadata is "out of whack" but the disk blocks holding that data is good, then you will just be putting the broken file system on the other external drive.  But if the problem is the disk drive, if the dd works, and all the file system metadata makes it over, then you might have a working file system.

rsync approach - this would be a File by File copy.

Here is an article on using rsync to create a bootable clone of your boot disk.  If you modify the instructions so that you point the source at your damaged_external and the destination at the good_external, it should work just as well.

ditto approach - There is the ditto command (man ditto)

Here is an article on using ditto to copy files