How to copy a file with I/O errors?

Customers sometimes have problems using our Treasured diagnostics tool or our repair tools. Among usual suspects, we have the dreaded I/O error causing a crash of the video application.

How to Detect an I/O Error

It’s easy to verify whether a file has I/O problems: Just try to copy it to a different location. If the operating system reports an error (Finder error -36 for Mac) then we have an I/O error.

error -36 Finder I/O error

I/O error means that the storage media (card, disk, …) cannot be read at a certain location. Think of it as a scratch on a DVD or a “bad sector” on a card or a disk. The bad news is that this “rough spot” is in the middle of your file.

If the “rough spot” is big (a big scratch on your DVD, hundreds or thousands of “bad sectors” on your disk), then the chances of recovery will be low.

But in any case, the first step is to generate a clean, error-free copy of the damaged file. Since some segments of the file are not readable, the best that can be done is to skip them. We will explain later how to do this.

With a clean copy of the file, parts of the original data are missing, but we no longer have I/O errors causing our diagnostics and repair tools to choke and crash.

How to Copy a File with I/O Errors

To salvage all readable data, we will use a fault-tolerant copy utility called dd.

dd stands for “disk duplication”. This is a command-line utility bundled with Mac OS X. A free version for Windows is also available for download.

Be extremely careful, even if you are familiar with command line, because dd can cause unrecoverable damage to your data if you don’t specify correctly input and output. You have been warned.

using dd to copy file with I/O errors

The arguments of dd are straight-forward:

  • if=path_of_file_with_IO_errors specifies input path
  • of=path_of_clean_copy_to_create specifies output path
  • conv=noerror,sync tells dd to be fault-tolerant

Your output path should not be on the same disk as the damaged file. Actually, you shouldn’t continue using the card or disk with I/O errors, because it’s likely to cause more problems in the future. After recovery the data, you should scrap it or at most use it to store unimportant stuff.

Using the Clean Copy

Due to I/O errors, dd can take more time to create the clean copy than a normal copy would take.

But it’s really worth the wait, because now we have a clean file on which we can use our arsenal of diagnostics, preview and video recovery tools.

I/O errors are a serious business, and scrapping the card after recovering the videos is probably the RIGHT THING TO DO. You should also consider that some amount of footage won’t be recovered, or with a less-than-stellar quality.

But that’s a whole lot more than what you have now, right?