Protecting archives from damage


RAR archive format supports a special type of redundant information called a recovery record. If an archive has a recovery record, it can be repaired even in case of physical data damage due to floppy disk failure or data losses of any other kind. The ZIP archive format does not support a recovery record.

To add a recovery record from the command line you may use switch -rr[N] together with any command, which creates or modifies an archive, or command "rr[N]" to add the recovery record to an existing archive. For example:

WinRAR a -rr newarc *.txt

WinRAR d -rr4 newarc dummy.txt

WinRAR rr oldarc

In WinRAR shell mode you may set "Put recovery record" option in Archive name and parameters dialog to add the recovery record to an archive. Another way is to set "Put recovery record" option in the default compression profile. In this case a recovery record will be added to archives after any archive modification.

The recovery record contains up to 524288 recovery sectors. If data is damaged continuously, then each recovery sector is able to recover 512 bytes of damaged information. This value may be lower in cases of multiple damage.

The number of sectors may be specified directly in the "rr[N]" command or "-rr[N]" switch (N = 1, 2 .. 524288). If it is not specified by the user, it will be selected automatically according to the archive size: a size of the recovery information will be about 1% of the total archive size, usually allowing the recovery of up to 0.6% of the total archive size of continuously damaged data.

It is also possible to specify the recovery record size in percent to the archive size. In the command line mode just append the percent character to the command parameter. For example:

WinRAR rr3% arcname

In the shell mode you may set it either using Protect archive command or setting the recovery record size in the Advanced options of Archive name and parameters dialog.

The recovery record increases the size of an archive. The size of the recovery record may be approximately determined by the formula:

<archive size>/256 + <number of recovery sectors>*512 bytes.

To repair a corrupt archive, which has a recovery record, in WinRAR shell mode apply "Repair" command to it. In the command line use command "r". The repaired archive will have name fixed.arcname.rar, where 'arcname' is the original (damaged) archive name. If a corrupt archive does not contain a recovery record or if an archive is not completely recovered due to major damage, a second stage is performed. During this stage only the archive structure is reconstructed and it is impossible to recover files, which fail the CRC validation, but it is still possible to recover undamaged files, which were inaccessible due to the corrupt archive structure. This is useful only for non-solid archives. When the second stage is completed, the reconstructed archive will be saved as rebuilt.arcname.rar, where 'arcname' is the original archive name.