PAR and PAR2 files can be used to reconstruct missing parts of the Usenet posting. If used correctly, they can be very handy.
PAR is short for the PARity file. They are also called Parchive parity files. PAR file uses a similar principle as the one used on RAID (Redundant Array of Independent Disks) disk system where it is used to recover data if one of the disks from the array fails. On the Usenet it is used to recover data from multipart split posts.
To achieve this, it contains a redundant data that can be used to recover parts of an original data in case if some of the original data is lost. However, there is a catch - to recover, for example, 5 files of the original data - you require at least 5 PAR files as well. 4 will not do.
A common example being used to illustrate this in the newsgroups is a large RAR archive file split into a multipart post. When split into multiple volumes, RAR file is a set of smaller files often named with extensions RAR for the first part, which continues with R01, R02 etc. for the following parts. To unpack the original file you need them all.
Newsgroups servers sometimes don't transfer the entire set for various reasons. Some of them include retention - new files overwriting older ones, server communication problem, poster never finishing the upload and similar. So you may be stuck with unusable archive just because you are missing one or two parts. But if the person distributing the original files posted a few PAR files in addition to the RAR archive, then you are lucky - you are able to recover the missing parts. If you are missing 2 parts, then get 2 PAR files to recover them.
Here is a very simplified example how PAR file is calculated. The difference with the real thing is that files are larger and that the calculations are performed a bit different but the principle is the same.
File # | Original data in files | The math | The result (same as original) |
---|---|---|---|
1 | 3 | 16 - 1 - 5 - 7 | 3 |
2 | 1 | 16 - 3 - 5 - 7 | 1 |
3 | 5 | 16 - 3 - 1 - 7 | 5 |
4 | 7 | 16 - 3 - 1 - 5 | 7 |
PAR file data for the above | |||
5 | 16 | 3 + 1 + 5 + 7 | 16 |
As you can see - from single PAR data you can recover any of the missing parts.
Now - how it works on the Usenet - let's say we have a RAR file split into 8 parts posted on the Usenet server. Other servers pick the file parts from the first server or from each other.
Original file posted on Usenet server #1 | Usenet server #2 (Alice) | Usenet server #3 (Gary) | Usenet server #4 (Paul) | Usenet server #5 (Bob) |
---|---|---|---|---|
RAR | RAR | RAR | RAR | RAR |
R01 | R01 | X | R01 | X |
R02 | X | R02 | R02 | X |
R03 | R03 | R03 | R03 | X |
R04 | X | R04 | R04 | X |
R05 | R05 | R05 | R05 | R05 |
R06 | R06 | X | R06 | R06 |
R07 | R07 | R07 | R07 | R07 |
In the above example you can see that some servers didn't get all of the parts e.g. server #2 failed to get files 2 and 4. Server #4 is the best of them all and got all the RAR file parts. The names next to the servers are used illustrate example users browsing the post on that particular server. Let's also assume the person that posted the original also posted 2 PAR files.
Take a look at the user called Alice. She can see the post but parts 2 and 4 are missing. She needs to get 2 PAR files and she'll be able to recover the missing parts.
Gary on the other hand does not have parts 1 and 6 but he is also able to successfully recover them if he gets 2 PAR files.
Paul doesn't need PAR files at all. His server got all the parts for him.
And finally Bob - unfortunately, there are only 2 PAR files and Bob misses 4 parts. He is unable to recover the archive as the redundant data for the posted files measures 25% (2 out of 8).
Note: You cannot use same PAR file over and over with various sets. It needs to be from the same set of original files. So the PAR recovery is only possible if the poster distributed the PAR files with the originals.
PAR (or PAR1) has some limitations when compared to PAR2:
PAR2 files are more economical to use because they are smaller. Basically, they operate very similar to PAR files but they split the file into smaller blocks therefore replacing the blocks instead of entire file. Each PAR2 file can reconstruct specific number of blocks, depending on its size.