Wednesday, October 20, 2010

Making parity files, redux

In working out my first method of creating a parity file set, I was looking through the options you get running RAR in command line. And I saw the "-rv switch".

This does the whole of the first method for you in one go!

The same idea applies that you split your file into 2 chunks of equal size. From the manual:

"Each recovery volume is able to reconstruct one missing RAR volume. For example, if you have 30 volumes and 3 recovery volumes, you are able to reconstruct any 3 missing volumes. If the number of .rev files is less than a number of missing volumes, reconstructing is impossible".

So the command looks like

    $ /applications/rar/rar a -rv -v26250k photos.rar Photos.dmg.rar

As before we get our chunks, but now the -rv switch creates an extra, .rev, recovery file


When I need to unrar the file, and one of the parts is missing, the .rev is used

    $ /applications/rar/unrar e photos.part2.rar

    UNRAR 3.93 freeware Copyright (c) 1993-2010 Alexander Roshal

    Extracting from photos.part2.rar

    Calculating control sums of all volumes.
    1 recovery volumes found
    Cannot find volume photos.part1.rar
    1 volumes missing
    Reconstructing... 100%

    Extracting from photos.part1.rar

    Extracting Photos.dmg.rar 50%

    Extracting from photos.part2.rar

    ... Photos.dmg.rar OK
    All OK

and I'll get my file back.

If you want to increase your reslience further, you can create more than 1 .rev file.

    $ /applications/rar/rar a -rv2 -v18000k photos.rar Photos.dmg.rar

So this command will create 2 .rev files which means that of the three files created, I can lose any 2 and still get my data back.

No comments: