Rsync

From APIDesign

Jump to: navigation, search

rsync is said to be useful for remote synchronization (hence the r as the first letter). However I've just found other meaning of the initial r: It may mean Recovery!


Disk Recovery

I had problems with my home computer and lost one hard drive. Alas, it contained collection of my family photos and videos collected during last ten years. No problem, I though, I have a backup. However to make things worse, the backup hard disk is also slightly damaged! It contains about 1% of back blocks. What shall I do now?

I tried various tricks, but usual copy programs just stop when they see a broken bit in a file. They prefer correctness. Rather copy nothing than produce not perfect result! Nice contribution to my favorite MartinRinard presentation: Image:RinardOOPSLA06.pdf.

Refusing to copy image or video files just because there is one broken bit is not the right strategy. I don't care if a single frame in a five minutes video is broken! Just skip it. MartinRinard would say: we don't need perfect programs without errors, we need good enough ones. I can add: We don't need perfect pictures and movies, we need ones that look OK.

For a while I wanted to write my own copying program. Just open java.io.RandomAccessFile, read 4KB, if OK, go on, if not flush out 4KB of zeros and go on as well. But then I realized there already is such a rescue tool:

rsync -ruv -P --ignore-existing /misc/damaged-disk/  /misc/newbackup/

Such operation takes ages (the I/O timeout is way to high and I don't know how to decrease it), but it does the trick. All files are copied, some of them with errors, but usually just insignificant, so the picture or video still looks acceptably.

Digital Aging

From time to time there are little flashes, when the playback is damaged, but at least it is clearly visible that the recording is old! Which remains me: we are used to the fact that analog recordings age and get worse over time. I never expected something like that in digital era, but it just happened: some bits from my files are gone, damaged, yet most of the information is still there. My digital bits are aging! However thanks to rescue sync and its relaxed ability to work with imperfect files I still have now good enough (yet aged) family album with me.

<comments/>

Personal tools