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 just learned about .rev files with WinRAR -- where if you have a 10-part RAR volume, for example, plus one .rev (recovery) volume -- the .rev volume will be able to "fix" any one corrupted .rar volume.

How is this possible? I don't understand how one volume could have all the data to fix any/all of the individually broken volumes.

I'd guess that it's perhaps possible in lieu of the volumes not being broken up "linearly", like I'm imagining, where each RAR volume holds distinct, individual files of the whole packed within; but rather, perhaps .rev repairing is possible when the RAR volumes are viewed as one continuous file of bits and bytes, so to speak, and that perhaps there's some CRC'ish sorcery (ah hem, "repair work") involved to fix corrupted bytes.

But I just don't understand how you can have 9 working volumes with 1 damaged, yet have a recovery volume that can repair any one of the volumes. How is one volume able to hold data of "all" the volumes?

share|improve this question
3  
Erasure correction codes. Compare with en.wikipedia.org/wiki/Parchive –  Dan D. Nov 18 '12 at 22:51

2 Answers 2

up vote 47 down vote accepted

Lets take a really simple case.

You have four volumes and a recovery volume, each with 1 bit of information in it:

         ========================================================
Volumes: = Volume 1 = Volume 2 = Volume 3 = Volume 4 = Recovery =
         =----------=----------=----------=----------=----------=
   Bits: =    1     =    0     =    1     =    1     =     1    =
         ========================================================

The recovery volume would contain the result of each of these bits XORd together:

1 XOR 0 XOR 1 XOR 1 = 1

So, our recovery volume contains the single bit 1.


Now, lets say volume 1 fails.

If we XOR the remaining volumes 2, 3 and 4 with the recovery bit in place of the failed volume we get:

1 XOR 0 XOR 1 XOR 1 = 1
^

So, this tells us that volume 1 contained 1, since it is the result of the equation.

Let us pretend volume 2 died instead, so we replace it's value in the equation with the recovery bit:

1 XOR 1 XOR 1 XOR 1 = 0
      ^

So we know that volume 2 contained 0, since it is the result of the equation.

If volume 3 or 4 failed, they would both produce 1 in this equation.


So, if any of the volumes failed, the recovery volume can be used to reconstruct the data based on the remaining volumes. This is probably the simplest form of error correction you can have. If two volumes failed, you can't recover anything.

share|improve this answer
4  
To be clear, there are schemes that allow you to recover from multiple volume failures. –  Dietrich Epp Nov 19 '12 at 7:29
    
This does only work if you know which device failed, doesn't it? –  heinrich5991 Nov 19 '12 at 15:05
1  
@heinrich5991 you know by the internal CRC of the volume –  ratchet freak Nov 19 '12 at 16:41

For a really simple way to understand how this could be, imagine if the recovery volume contained the sum of the other volumes. With a list of numbers, missing one of them, and their sum, you can always reconstruct the missing number.

For example, consider these two digit numbers, 13, 88, 17, 43. If you knew that there was one missing number and the last two digits of the sum of all the numbers was 81, you could find the missing number. 13 + 88 + 17 + 43 = 161. The only two-digit number you can add to that to make a number that ends in 81 is 20.

Say you had the 20 and were missing the 43. 13 + 88 + 17 + 20 = 138. The only two-digit number you can add to that to make a number that ends in 81 is 43.

Thus the recovery number lets you find any one missing number.

share|improve this answer
    
Simple and well put -- thanks! –  Coldblackice Jul 5 '13 at 18:55

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.