Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an HDD with plenty of files, some of which are unfortunately corrupted. I'm now trying to copy the good files into a new HDD. I'm using:

rsync -azP SRC TGT

When rsync comes to one of the corrupted files, I can see a message in the console:

rsync: read errors mapping XXX: Input/output error (5)

In the target folder, I still see the corrupted file, which I'm not able to open and which I have to delete manually.

Is there any option to tell rsync not to copy files after a i/o error?

share|improve this question

2 Answers 2

This would do the job even though it doesn't answer your question to stop on error:

rsync -aP --partial-dir=/cygdrive/j/broken /cygdrive/g /cygdrive/j/gee

Files that are not wholly readable will stay in partial-dir. /cygdrive/j is a mountpoint of new, and /cygdrive/g mountpoint of old broken disk.

share|improve this answer

I don't think you can force it to stop on that error. You'll have to log the errors, clean up the problem files and run rsync again.

Mike Bombich has a good page describing your error -- What are "Input/output" errors, and how can I resolve them?

"These errors are typically a result of media damage — some of the "sectors" on the hard drive have failed and Mac OS X can no longer read data from them. When that is the case, the file or files that are using the bad sector must be deleted and restored from a previous backup. Once you have deleted the files that were called out in the CCC.log file, you should be able to run your backup task again with success."

Even though he's referring to CarbonCopyCloner, it uses rsync to manage synchronizing the clone, so the same would apply here.

By the way, the version Apple provides (2.6.9) is out of date, and doesn't properly handle HFS+ metadata. The latest version is 3.0.7, which does support all the metadata for a proper backup.

Mike has a page (http://www.bombich.com/rsync.html) documenting compilation, installation and use of the new version. Be sure to check the switches and options he applies for backup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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