How do I make rsync ignore unreadable files (damaged sectors)?

Stefan Nowak at
Tue Dec 22 08:39:29 MST 2009

The only low-budget test ideas I have:

1) Start rsync, and while it is running unmount the source drive,  
either by software or simply by physically disconnecting it. But I am  
not sure whether this results in the same I/O endless timeout, or  
wether this causes different error signaling than a bad block.
2) Connect the hard disk via an open cable with a certain "security  
distance" to the computer and harddisk, and then apply a strong  
magnetic field on the cable, to cause transfer data corruption, which  
might be intercepted by CRC, possibly causing a I/O error, or certain  
retry loops, being similar to the scenario which you may want to test.
3) Program some virtual /dev/ices, and put I/O errors in there  

The additional interesting question, which arises out of this topic  
for me:

How can one voluntarily "smash" only a particular sector of a hard  
disk drive? Even if you had a test HD for "smashing", you don't know  
whether you will completely destroy the HD or only partially, and if,  
which sectors/parts. The only idea I have so far, is to write a file  
knowingly to a certain sector with a low level tool (which one?), and  
then somehow get the disk firmware to mark one or some of the desired  
sectors as "bad" (but again, with which tool? And how without that a  
"healing mechanism" tries to move the affected file to a healthy  

The CD scratching a la Tomas Gustavsson seems the only easily  
achievable solution. But then it is not sure whether the OS does the  
reading retries or whether the optical disk drive itself retries  

Am 22.12.2009 um 13:18 schrieb Tomas Gustavsson:

> Yeah, I got an Input/Output error when running strace.  I don't have  
> the luxury to smash my harddrive so testing with a CD is my only  
> choice (afaik) right now. Still, I do think that rsync should give  
> up after a long time, but it doesn't. So, any advice?
> 2009/12/22 Paul Slootman <paul+rsync at>
>> I suspect that this is more down to the OS and the CDROM drive both
>> trying very hard to read the damaged data. You would have to do a  
>> strace
>> or similar to determine whether rsync is actually getting IO errors  
>> from
>> the OS or not.
>> On Tue 22 Dec 2009, Tomas Gustavsson wrote:
>>> So I took a CD (which I scratched with a needle) and mounted it to  
>>> the file
>>> system. There after I started the backup job which went on forever  
>>> and never
>>> got completed. It seems that rsync refused to understand that the  
>>> file it
>>> tried to copy was located on damaged sectors on the CD, and there  
>>> fore was
>>> unreadable.

More information about the rsync mailing list