How far will two PAR2 blocks get you?
We damaged three bytes in a test file twice. One copy was repairable, the other needed another PAR2 block. Here is how to read the difference in a Usenet job.
Three damaged bytes in a 2 MiB file sounds like an easy repair. In our first run it was. In the second, the same two recovery blocks fell short. All we changed was the distance between the bad bytes.
Two runs with the same recovery volumes
We generated 2 MiB of random data, divided it into 32 blocks of 64 KiB, and asked par2cmdline to create four recovery blocks in two equal volumes. This was the creation command for our test file. par2cmdline documentation
par2 create -s65536 -c4 -u -n2 archive.par2 archive.bin
We set one recovery volume aside. With two recovery blocks still available, we flipped one bit in each of three bytes, then ran par2 verify archive.par2. Between runs we restored the original data. Byte positions below start at zero.
| Damaged byte positions | Intact source blocks | Verification result |
|---|---|---|
| 0, 1, 2 | 31 of 32 | Repair possible, one recovery block to spare |
| 0, 65,536, 131,072 | 29 of 32 | One more recovery block needed |
In the first run the three bytes shared a block. In the second each sat at the start of a different block. Returning the second volume to the directory gave the repairer four recovery blocks. It used three and produced a file byte-for-byte identical to the original.
What to fetch on a metered block account
A downloader counts failed NNTP articles. The verifier counts source blocks it can still identify in the assembled files. One missing segment can straddle two PAR2 blocks. Several failed segments can also damage the same block. If the assembled files are available, run verification before deciding how much more to download.
In our example, the small archive.par2 supplied verification metadata. The volumes were named archive.vol0+2.par2 and archive.vol2+2.par2. Each supplied two distinct recovery blocks. Fetching the first volume again would have added zero to our repair budget. The second volume supplied the extra capacity we needed. par2cmdline manual
For a real job, take the verifier’s additional blocks needed as your starting point. Look for an available volume from the same recovery set containing enough fresh blocks. If a fill server can return an original segment instead, assemble it and verify again. Its value depends on how many source blocks it makes whole.