How to interpret and fix a Input/output error in Linux?
The rsync error
read errors mapping ....: Input/output error (5)
indicates the impossibility of rsync to read or write a file. The most likely causes of this error are disk defects, either in the SRC or in the TGT directory. Other possibilities however include insufficient permissions, file lock by anti-virus programs, and maybe
other causes.
The first step toward a diagnosis is to try to copy the files manually. This may work if, for instance, the source of the error was a disk defect in the TGT directory; by repeating the operation at a later time, you will write into a different section of the disk, and the problem may have evaporated.
Alternatively, you may discover that you cannot access the file in the SRC directory. In this case I suggest that you employ any of the disk checking utilities available to your distro.
Insufficient privileges, anti-virus, are easier to diagnose.
Lastly, if you have a bad sector on your SRC directory, you may exclude that from future runs of rsync by means of
rsync -av --exclude='/home/my_name/directory_with_corrupt_files/*'
I had a similar issue, I had a with fuse-mounted device via USB, which would frequently disconnect, causing IO errors. My backup could never finish because the IO errors would start mid-way into the rsync, and despite running rsync repeatedly, at some point the sync would not progress beyond updating existing files.
My solution was to use
--ignore-existing
option. This way I could run the sync in a loop until seeing a 0 exit status.
Of course, in this case I didn't care about updates to existing files.