PAR & PAR2 Files
PAR/PAR2 files, or Parity files, are God's gift to the newsgroups. They are the answer to the problem of missing or damaged files in an archive. [PAR]ity files are used to reconstruct files that are missing or damaged.
PAR Files: A Look Back
What about this gift you say? Developed in 2001 and open source in nature, PAR recovery files changed the newsgroups overnight. When the first PAR files were implemented, they were designed to replace a file whether it was only slightly damaged or completely missing. During an archive's propagation throughout Usenet, it's not uncommon for an achive to suffer damage to a few files (or parts). Before there were PAR files, if an archive was damaged or a part was missing, the only recourse for the user was to request a repost. This approach had its problems. It could take a while for a repost to appear, or perhaps never happen. This was another contributing reason why the newsgroups remained an elusive method of information for a majority of users.
Once PAR files began accompanying archive posts, the newsgroup world changed overnight. Original PAR files worked in a 1:1 ratio; for every 1 archive part that was damaged or missing (for example, "A Great Movie.part01.rar"), you needed 1 PAR file of equal size to replace it (see Figure 1). There's an important distinction to make, original PAR files could not repair individual blocks (the smaller pieces that make up a part), PAR files could only replace the entire part. So even if a part suffered minor damage to only a few blocks, the entire part had to be replaced. But that was OK; even with this shortcoming PAR files were quickly hailed as a massive step forward in data-recovery technology.
PAR2 Files: The Great Leap Forward
PAR2 files, which are now the standard of archive posting, are an even greater leap forward. Although the mission of PAR and PAR2 files are similar, PAR2 files are more advanced. Like PAR files, they can replace a missing archive part, but unlike their predecessor, they can also repair blocks. This makes PAR2 files not only more advanced, but more economical as well (see Figure 2). For example, if you downloaded an archive part that had superficial damage to a few blocks, the PAR2 file would repair only the superficial damage rather than replace the entire file. This means that smaller recovery (or repair) files can be posted, which saves on bandwidth. Also, the remaining balance of the PAR2 file is available to either repair or replace other files in the archive.
Figure 2: PAR2 Files At Work...
PAR2 Files: The Technical Lowdown
PAR/PAR2 files can be a bit difficult to understand. Let's say a part from an archive was missing - and that part contained data of a car rolling down the street. How does a PAR/PAR2 file know how to reconstruct the data so it seamlessly fits in with the rest of the video? An archive part, when it's encoded back into a binary file, is just a file made up of bits of information (0100010101001). The same is true about PAR/PAR2 files. After an archive is made, PAR/PAR2 files are created in the next step. There are quite a few programs that can make PAR/PAR2 files, but they essentially do the same thing.
When the PAR/PAR 2 files are being created, an algorithm is applied to the data to help create the PAR/PAR2 files (see Figure 3). The total of the bits (0 or 1) from each column is added, for example column one would be 1+1+1+0=3. If the number is odd, the first bit of the PAR will be 1, if the number is even (such as column three (1+0+0+1=2), the third bit of the PAR/PAR2 will be 0. This continues for each of the columns of the archive.
Figure 3: The 411 On PAR/PAR2 Files...
As an example, let's say the first bit in part 2 is damaged (see Figure 3). We know that during the PAR2 creation process the total of the first column is an odd number. In order to repair the file, either a 1 or a 0 will be used, but which? It's easy. If the recovery file adds a 1, the result would give us the total we want (1+1+1+0=3), and properly repair the file. Go PAR files!
But What Does It All Mean Basil?
Figure 4 provides an example of what a PAR2 archive looks like. In this archive, there are a total of 7 PAR2 recovery files and 1 small indexing PAR2 accompanying this post. First, take a look at Figure 4a. This column defines how many blocks each PAR2 file can repair. Now take a look at Figure 4b - that's the size of each PAR2 file. As you can see, there is a direct relationship between the two.
Figure 4: The PAR2 Archive Structure...
The larger the PAR2, the more blocks it can repair. For example, when we see a PAR2 file such as: 105563112706.vol03+04.par2, this PAR2 file can repair up to 4 blocks (expressed as "+04"). The "vol03" value refers to the total number of blocks that all the preceding PAR2 files can repair. Here, "vol00+01.par2" can repair 1 block, while vol01+02.par2" can repair 2 blocks; when combined, they can reconstruct 3 blocks. If we know that any 7 blocks are damaged, we would take "vol03+04.par2" and the two PAR2 files before it ("vol00+01.par2" and "vol01+02.par2) to achieve the 7 blocks necessary to repair the archive.
PAR2 Files: What's That Little PAR2?
There's another variety of PAR2 file that indexes the hash information of the archive for error reporting purposes. It contains no recovery data. Rather, it's used in conjunction with QuickPar or your news reader to report how many PAR2 recovery files are needed, if any, to repair/replace a part.
The good thing about the modern news reader is that it works harmoniously with small PAR2 files and NZB files. The small PAR2 reports to the news reader the integrity of the archive; if there's any damage, the newsreader calls upon the NZB file to locate the proper number of PAR2 recovery files. Thanks to the bandwidth friendly nature of PAR2 files, considerable bandwidth is saved.
Although users typically depend on their news reader to repair an archive, QuickPar is still a good program to have. QuickPar is a utility that does two things: 1) uses the small PAR2 file to error check an archive, and 2) uses recovery files to reconstruct an archive.
Why do you need QuickPar? Because it's handy even if you rely exclusively on NZB files. Every once and a while, and for whatever reason, your news reader may not repair an archive. So what do you do, delete the archive and call it a day? No way! Before you give up, try reconstructing it manually. This trick often works. QuickPar is a free program that every Usenet traveler should have.