par2(1)

๐ŸŽ€ par2(1) โ€” Parity archive utils ๐ŸŽ€

okay bestie, welcome to the par2(1) page from Parity archive utils. this is the PAR 2.0 compatible file verification and repair tool, and we're gonna walk through it together. no cap. โœจ

๐ŸŒธ NAME ๐ŸŒธ

par2 โ€” PAR 2.0 compatible file verification and repair tool.

๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

par2 c|v|r [options] <PAR2 file> [files]

par2 c(reate) [options] <PAR2 file> [files]
par2 v(erify) [options] <PAR2 file> [files]
par2 r(epair) [options] <PAR2 file> [files]

Also:
par2create [options] <PAR2 file> [files]
par2verify [options] <PAR2 file> [files]
par2repair [options] <PAR2 file> [files]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

So par2cmdline is the actual program, and it creates and uses PAR2 files to detect damage in data files and repair them if necessary. It can be used with any kind of file, which is honestly iconic of it.

๐Ÿ”ฅ OPTIONS global ๐Ÿ”ฅ

  • -h โ€” shows this help. the thing you're reading, basically.
  • -V โ€” shows version.
  • -VV โ€” shows version and copyright. fancy.

๐Ÿซถ OPTIONS all uses ๐Ÿซถ

these hit every mode, bestie:

  • -a <file> โ€” sets the main PAR2 archive name; it's required on create, and optional for verify and repair.
  • -B <" path > โ€” sets the basepath to use as reference for the datafiles.
  • -v [-v] โ€” be more verbose. stack it if you want more, more, more.
  • -q [-q] โ€” be more quiet; -q -q gives silence. the group chat goes on mute.
  • -m<n> โ€” memory in MB to use; default is half of total physical memory.
  • -t<n> โ€” number of threads used for main processing; default is auto-detected.
  • -T<n> โ€” number of files hashed in parallel; default 2.
  • -- โ€” treat all following arguments as filenames. no option drama after this point.

๐ŸŒˆ OPTIONS verify or repair ๐ŸŒˆ

  • -p โ€” purges backup files and par files on successful recovery or when no recovery is needed.
  • -O โ€” rename-only mode: skips files that are not perfect matches, useful for quickly fixing renamed files.
  • -N โ€” data skipping (find badly mispositioned data blocks).
  • -S<n> โ€” skip leaway: the distance +/- from the expected block position, default 64.
  • --full-hash โ€” also checks the hash of the whole of each file, not only the hash of each of its blocks.

๐Ÿ“ OPTIONS create ๐Ÿ“

  • -b<n> โ€” sets the Blockโ€Count; default is 2000 when neither -b nor -s is specified.
  • -s<n> โ€” sets the Blockโ€Size; don't use both -b and -s.
  • -r<n> โ€” level of redundancy, as a percentage; default 5%.
  • -r<c><n> โ€” redundancy target size, where <c> is g(iga),m(ega),k(ilo) bytes.
  • -c<n> โ€” recovery block count; don't use both -r and -c.
  • -f<n> โ€” First Recoveryโ€Blockโ€Number; default 0.
  • -u โ€” uniform recovery file sizes; default is variable sizes.
  • -l โ€” limit size of recovery files; don't use both -u and -l.
  • -n<n> โ€” number of recovery files, max 31; don't use both -n and -l.
  • -R โ€” recurse into subdirectories (only useful on create).
  • -L โ€” follow symlinks to files when scanning for source files (create only). Use at your own risk: symlink targets may lie outside the basepath. Symlinks to directories are not followed. POSIX systems only.
  • @ โ€” process a listing of files specified in text (file) input.

๐Ÿ‘‘ EXITCODES ๐Ÿ‘‘

  • 0 โ€” The process completed successfully.
  • 1 โ€” Repair is possible, there are sufficient recovery blocks.
  • 2 โ€” Repair is NOT possible, there are insufficient recovery blocks. this is the one you don't want, bestie.
  • 3 โ€” The given combination of commandline flags is invalid.
  • 4 โ€” Insufficient critical data, probably your par files are corrupted.
  • 5 โ€” Repair was completed, but datafiles are still corrupted.
  • 6 โ€” Some file IO error while accessing it.
  • 7 โ€” An internal logic error occurred.
  • 8 โ€” Out of memory or other memory error.

โœจ EXAMPLES โœจ

okay bestie, this is the part where it all clicks ๐Ÿ’– With PAR 2.0 you can create PAR2 recovery files for as few as 1 or as many as 32768 files. Like, one file or thirty-two-thousand-and-change, the range is genuinely unhinged and we love that.

Back in the PAR1 days? If you wanted recovery for a single file you were forced to split that file into multiple parts, and RAR was the go-to for that. But with PAR 2.0? You do NOT need to split files. Periodt. ๐ŸŽ€

So say you wanna create PAR 2 recovery files for one single data file (call it test.mpg) โ€” the command is literally this:

par2 create test.mpg

Now if test.mpg is an 800 MB file, this creates a total of 8 PAR2 files, named like this (and it takes roughly 6 minutes on a PC with a 1500MHz CPU, so go make a snack ๐Ÿ“):

test.mpg.par2   - This is an index file for verification only
test.mpg.vol00+01.par2 - Recovery file with 1 recovery block
test.mpg.vol01+02.par2 - Recovery file with 2 recovery blocks
test.mpg.vol03+04.par2 - Recovery file with 4 recovery blocks
test.mpg.vol07+08.par2 - Recovery file with 8 recovery blocks
test.mpg.vol15+16.par2 - Recovery file with 16 recovery blocks
test.mpg.vol31+32.par2 - Recovery file with 32 recovery blocks
test.mpg.vol63+37.par2 - Recovery file with 37 recovery blocks

The test.mpg.par2 file is 39 KB in size and the other files vary in size from 443 KB to 15 MB. These par2 files will enable the recovery of up to 100 errors totalling 40 MB of lost or damaged data from the original test.mpg file when it and the par2 files are posted on UseNet ๐Ÿ“ฎ

When you're posting on UseNet it's recommended that you use the -s option to set a blocksize that is equal to the Article size you'll use to post the data file. So if you wanted to post test.mpg using an article size of 300 KB, the command you'd type is:

par2 create -s307200 test.mpg

This creates 9 PAR2 files instead of 8, and they'll be capable of correcting up to 134 errors totalling 40 MB. This time it takes roughly 8 minutes to create the recovery files. In both of these two examples, the total quantity of recovery data created was 40 MB (which is 5% of 800 MB) โ€” math is mathing โœจ

Wanna create a greater or lesser quantity of recovery data? That's the -r option, bestie. To create 10% recovery data instead of the default of 5%, and also use a block size of 300 KB, you'd go:

par2 create -s307200 -r10 test.mpg

This would also create 9 PAR2 files, but they'd be able to correct up to 269 errors totalling 80 MB. Since twice as much recovery data is created, it takes about 16 minutes to do so with a 1500MHz CPU ๐Ÿ˜ญ (sorry to your CPU).

The -u and -n options can be used to control exactly how many recovery files are created and how the recovery blocks get distributed amongst them. They do not affect the total quantity of recovery data created โ€” important distinction, iykyk.

The -f option is the one you use when you create additional recovery data. e.g. if you've already created 10% and want another 5%, you might use:

par2 create -s307200 -r5 -f300 test.mpg

That specifies the same block size (which is a requirement for additional recovery files, no negotiating ๐Ÿ’…), 5% recovery data, and a first block number of 300.

The -m option controls how much memory par2 uses. It defaults to half of total physical memory unless you override it.


๐ŸŒˆ CREATING PAR2 FILES FOR MULTIPLE DATA FILES ๐ŸŒˆ

When creating PAR2 recovery files for multiple data files, you must specify the base filename to use for the par2 files and the names of all of the data files. So if test.mpg had been split into multiple RAR files, then you could use:

par2 create test.mpg.rar.par2 test.mpg.part*.rar

The filename test.mpg.rar.par2 says what you want the par2 files to be called, and test.mpg.part*.rar should select all of the RAR files. Slay, wildcards ๐Ÿฆ‹

With -R you can also create recovery files for a multi layered tree structure, like this gorgeous little diagram:

.
โ”œโ”€โ”€ aaaa-test.data
โ”œโ”€โ”€ subdir1
โ”‚   โ””โ”€โ”€ test-0.data
โ”œโ”€โ”€ subdir2
โ”‚   โ”œโ”€โ”€ test-1.data
โ”‚   โ”œโ”€โ”€ test-2.data
โ”‚   โ”œโ”€โ”€ test-3.data
โ”‚   โ”œโ”€โ”€ test-4.data
โ”‚   โ”œโ”€โ”€ test-5.data
โ”‚   โ”œโ”€โ”€ test-6.data
โ”‚   โ”œโ”€โ”€ test-7.data
โ”‚   โ”œโ”€โ”€ test-8.data
โ”‚   โ””โ”€โ”€ test-9.data
โ””โ”€โ”€ test-a.data
par2 create -R recovery.par2 *

Will result in:

.
โ”œโ”€โ”€ aaaa-test.data
โ”œโ”€โ”€ recovery.par2
โ”œโ”€โ”€ recovery.vol000+01.par2
โ”œโ”€โ”€ recovery.vol001+02.par2
โ”œโ”€โ”€ recovery.vol003+04.par2
โ”œโ”€โ”€ recovery.vol007+08.par2
โ”œโ”€โ”€ recovery.vol015+16.par2
โ”œโ”€โ”€ recovery.vol031+32.par2
โ”œโ”€โ”€ recovery.vol063+37.par2
โ”œโ”€โ”€ subdir1
โ”‚   โ””โ”€โ”€ test-0.data
โ”œโ”€โ”€ subdir2
โ”‚   โ”œโ”€โ”€ test-1.data
โ”‚   โ”œโ”€โ”€ test-2.data
โ”‚   โ”œโ”€โ”€ test-3.data
โ”‚   โ”œโ”€โ”€ test-4.data
โ”‚   โ”œโ”€โ”€ test-5.data
โ”‚   โ”œโ”€โ”€ test-6.data
โ”‚   โ”œโ”€โ”€ test-7.data
โ”‚   โ”œโ”€โ”€ test-8.data
โ”‚   โ””โ”€โ”€ test-9.data
โ””โ”€โ”€ test-a.data
WARNING: Be wary of wildcard shell expansion. Once you pass in more than one unnamed argument the first one will be used as the par2 files name and not be covered by those. โš ๏ธ Like, actually be careful here, bestie โ€” that first argument gets promoted and then it's not protected. Not the vibe.

๐Ÿ’… VERIFYING AND REPAIRING ๐Ÿ’…

When you're using par2 recovery files to verify or repair the data files they were created from, you only need to specify the filename of one of the par2 files to par2. For example:

par2 verify test.mpg.par2

This tells par2 to use the information in test.mpg.par2 to verify the data files. Par2 automatically searches for the other par2 files that were created and uses the information they contain to determine the filenames of the original data files, and then to verify them. Self-sufficient queen ๐Ÿ‘‘

If all of the data files are ok, then par2 reports that repair will not be required. If any of the data files are missing or damaged, par2 reports the details of what it's found. If the recovery files contain enough recovery blocks to repair the damage, you'll be told that repair is possible ๐ŸŽ‰ Otherwise you'll be told exactly how many recovery blocks will be required in order to repair. Dramatic but honest.

To carry out a repair, use:

par2 repair test.mpg.par2

This tells par2 to verify and, if possible, repair any damaged or missing files. And if a repair is carried out, then each file that's repaired gets re-verified to confirm the repair was successful. Double-checking is self-care ๐Ÿ’–


๐Ÿงš MISSNAMED AND INCOMPLETE DATA FILES ๐Ÿงš

If any of the recovery files or data files have the wrong filename, then par2 will not automatically find and scan them. To have par2 scan such files, you must include them on the command line when you're attempting to verify or repair; e.g.:

par2 r test.mpg.par2 other.mpg

This tells par2 to scan the file called other.mpg to see if it contains any data belonging to the original data files. If one of the extra files specified this way is an exact match for a data file, then the repair process will rename the file so it has the correct filename โœจ

And because par2 is designed to be able to find good data within a damaged file, it can do the same thing with incomplete files downloaded from UseNet. If some of the articles for a file are missing, you should still download the file and save it to disk for par2 to scan. Do that and you may find you can carry out a repair in a situation where you'd not otherwise have sufficient recovery data โ€” clutch ๐Ÿ™

You can have par2 scan all files that are in the current directory using a command such as:

par2 r test.mpg.par2 *

๐ŸŒธ RENAME-ONLY MODE ๐ŸŒธ

So you've accidentally renamed likeโ€ฆ many files that are protected by PAR2 files? Been there (not really but emotionally yes). You can use the rename-only mode to quickly identify and fix them. In rename-only mode, par2 skips files that are not perfect matches (i.e., files that are damaged or have mismatched blocks), which gives a massive speedup when you're dealing with many renamed files ๐Ÿ”ฅ

For example, if you have files that were accidentally renamed:

mv file1.dat renamed_a.dat
mv file2.dat renamed_b.dat
mv file3.dat renamed_c.dat

You can quickly fix them with:

par2 r -O recovery.par2 renamed_*.dat

Par2 will scan only the first block of each file to determine if it's a perfect match. If it is, the file gets renamed back to its original name. If it's not a perfect match (e.g. the file is damaged), it'll be skipped immediately without scanning the entire file. Iconic behaviour, no notes.

This is particularly useful when you have hundreds of gigabytes of renamed files protected by multiple PAR2 sets, since it avoids the slow block-by-block scanning that would otherwise be required. Like, your time is precious ๐Ÿ‘‘๐Ÿ’…


โญ WHAT TO DO WHEN YOU ARE TOLD YOU NEED MORE RECOVERY BLOCKS โญ

If par2 determines that any of the data files are damaged or missing and finds there's insufficient recovery data to effect a repair, you'll be told that you need a certain number of recovery blocks. You can obtain these by downloading additional recovery files ๐Ÿ“ฅ

And to make things easy, par2 files have filenames that tell you exactly how many recovery blocks each one contains. Assuming the following command was used to create recovery data:

par2 c -b1000 -r5 test.mpg

Then the recovery files that are created would be called:

test.mpg.par2
test.mpg.vol00+01.par2
test.mpg.vol01+02.par2
test.mpg.vol03+04.par2
test.mpg.vol07+08.par2
test.mpg.vol15+16.par2
test.mpg.vol31+19.par2

The first file in this list does not contain any recovery data โ€” it only contains information sufficient to verify the data files. Each of the other files contains a different number of recovery blocks. The number after the + sign is the number of recovery blocks, and the number preceding the + sign is the block number of the first recovery block in that file ๐Ÿงฎ

So if par2 told you that you needed 10 recovery blocks, then you'd need test.mpg.vol01+02.par2 and test.mpg.vol07+08.par. You might of course choose to fetch test.mpg.vol15+16.par2 instead, in which case you'd have an extra 6 recovery blocks that wouldn't be used for the repair. Overachiever energy, honestly valid ๐Ÿ’œ


๐Ÿฆ‹ HASHING ๐Ÿฆ‹

Hashing portion (file verification and creation stages) of the code can't be parallelized without processing multiple files simultaneously. The 2 file/thread default is a good choice for HDDs โ€” using more threads can result in worse performance, which is so counterintuitive but okay. Four or more threads can be used for better performance with SSDs โœจ


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

  • Peter Brian Clements <peterbclements@users.sourceforge.net>
  • Marcel Partap <mpartap@gmx.net>
  • Ike Devolder <ike.devolder@gmail.com>
  • Jussi Kansanen <jussi.kansanen@gmail.com>

That's the whole page, bestie โ€” you made it to the end ๐ŸŽ€๐Ÿ’– This little gem is from source/version 1.4.0, dated september 2026, and it's a par2(1) manual page. Go forth and repair your data, you absolute main character ๐ŸŒˆโญ๐Ÿซถ

๐Ÿ“ฆ where this page comes from