# par2cmdline protects files with recovery blocks instead of backups

> par2cmdline is the reference implementation of PAR 2.0, creating recovery sets that let you repair damaged or renamed files using only as much redundancy as the damage requires. It is a command line tool first and a library second, and it builds cleanly with CMake on Unix, Windows and cross targets.

**Parchive/par2cmdline** — Official repo for par2cmdline and libpar2

- Repository: https://github.com/Parchive/par2cmdline
- Website: https://parchive.github.io
- Stars: 946 · Forks: 112
- Language: C++
- License: GPL-2.0
- Published: 2026-10-20 · Updated: 2026-10-20 · Language: en
- Canonical page: https://hysenlabs.com/projects/parchive-par2cmdline

## Recovery blocks instead of a second copy of the data

par2cmdline is a PAR 2.0 compatible file verification and repair tool. The project describes it as a program for creating and using PAR2 files to detect damage in data files and repair them if necessary, and it can be used with any kind of file.

The model is different from making a backup. Instead of storing a second copy of your data, you generate a set of recovery files whose total size you choose as a percentage or a target size, and those recovery files are held by other people or stored elsewhere. When the recipient finds that a file is damaged or has been renamed, the tool verifies the set, works out which blocks are missing or wrong, and rebuilds them from the recovery data.

The payoff is that only the damage is paid for. The PAR 2.0 documentation in the project makes the point that damaged data files are still usable during the recovery process, so less recovery data is required to achieve a successful repair, and it is therefore not necessary to create as much recovery data in the first place to achieve the same level of protection.

This makes it a good fit for distributing albums, datasets or firmware images over channels where you cannot control the storage. It is also why it is a good fit for the seedbox scene, where uploaders hand recovery files to other participants.

One thing it is not is a backup tool. If the recovery files and the data end up on the same failing disk, nothing is recovered.

## What PAR 2.0 changes against PAR 1.0

The project lists the reasons it prefers PAR 2.0, and they are structural rather than incremental.

It is not necessary to split a single large file into many equal-sized small files, although you can still do so if you wish. There is no loss of efficiency when operating on multiple files of different sizes, which matters when the payload is a directory rather than one archive. Recovery files may be of different sizes, which makes it possible to obtain exactly the amount of recovery data required to carry out a repair, and damaged or incomplete recovery files can themselves be used during recovery in the same way that damaged data files can.

The limits also moved. PAR 2.0 can protect up to 32768 files rather than the 256 that PAR 1.0 is limited to, and it can repair damaged files using exactly the amount of recovery data that corresponds to the amount of damage, rather than requiring complete reconstruction of the damaged file.

The project is honest about the cost. All PAR 2.0 programs will take somewhat longer to create recovery files than a PAR 1.0 program does. That disadvantage is considerably mitigated by the fact that you do not need to create as much recovery data in the first place to provide the same level of protection.

For a current tool, PAR 1.0 is a historical curiosity. The interesting consequence for a user today is that the number of recovery files is bounded, since the -n option documents a maximum of 31 recovery files, and that bound sits inside a tool that can otherwise protect tens of thousands of data files.

## Building on Linux and other Unix systems

The build is CMake based and the documented Unix path is four commands. Configure a release build, compile it, run the test suite, and install:

```bash
cmake -B build-cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build-cmake -j"$(getconf _NPROCESSORS_ONLN)"
ctest --test-dir build-cmake
cmake --install build-cmake
```

The parallel build is sized from the number of processors the system reports, and the test step is a plain ctest invocation against the build directory, so a failing test stops the sequence before anything is installed.

If your CMake is 3.21 or later, the same work is available through the presets committed in CMakePresets.json:

```bash
cmake --preset release
cmake --build --preset release
ctest --preset release
```

On FreeBSD the project asks you to install the dependencies first:

```bash
pkg install git cmake
```

The build is also usable without the command line tool. Four options control what gets produced, and the first of them is the interesting one for anyone embedding the library:

```
-DPAR2_BUILD_TOOL=OFF     build only the library
-DPAR2_BUILD_TESTS=OFF    skip the test suite
-DPAR2_INSTALL=OFF        skip the install rules
-DPAR2_KEEP_ASSERTS=ON    keep assert checks in an optimised build
```

The repository ships include/ and src/ directories along with a man/ directory and a tests/ directory, and the project states its goals as being the reference implementation for par2 handling and being usable as a library, of which the command line is one application.

## Windows builds, cross toolchains and the test matrix

On Windows the documented route is Visual Studio, which offers the x64 Debug and x64 Release configurations in CMakePresets.json, or a command prompt:

```bash
cmake -B build-cmake -A x64
cmake --build build-cmake --config Release
ctest --test-dir build-cmake -C Release
```

There is one wrinkle the documentation spells out. The resulting par2.exe needs the Visual C++ runtime, and to produce a binary that carries the runtime with it, as the released executables do, you add -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded to the first command.

Cross compiling is supported through toolchain files in the cmake/toolchains directory, and the project names them: one for Windows with MinGW-w64, x86_64-w64-mingw32.cmake, one each for 64-bit and 32-bit Arm Linux, aarch64-linux-gnu.cmake and arm-linux-gnueabihf.cmake, and one for FreeBSD, where freebsd.cmake says how to give it a sysroot. A cross build looks like this:

```bash
cmake -B build-windows -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/x86_64-w64-mingw32.cmake
cmake --build build-windows
```

The testing story for cross builds is the part with a sharp edge. The emulator a toolchain file looks for is installed Wine for Windows and qemu-user for Arm, and ctest runs the tests of the cross build under it. The test scripts run the par2 executable directly, which for Arm needs qemu registered with binfmt_misc, as the qemu-user-static package does. In other words, a cross build that skips tests, with -DPAR2_BUILD_TESTS=OFF, saves you from setting up an emulator as well.

## The command line: create, verify, repair

The tool has three verbs, and the same options apply to all of them:

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

Long forms exist as well, par2create, par2verify and par2repair, and the -h and -V flags show help and version.

The options tell you how much redundancy to create and how hard to work. The -r option sets the level of redundancy as a percentage, while -r<c><n> sets a redundancy target size with c being g for giga, m for mega and k for kilo bytes. The -c option sets the recovery block count, and the documentation is explicit that you should not use -r and -c together, the same warning that applies to -b and -s for block count and block size, to -u and -l for uniform and limited recovery file sizes, and to -n and -l for the recovery file count.

The -n option caps the number of recovery files at 31. Workload options include -t for the number of threads, auto-detected by default, -T for the number of files hashed in parallel, and -m for the memory in megabytes to use.

Two options are worth calling out because they handle the most common real problems. The -O option enables rename-only mode, which skips files that are not perfect matches and is described as useful for quickly fixing renamed files. The -p option purges backup files and par files on successful recovery or when no recovery is needed.

## A reference implementation with a GPL v2 licence

The stated project goals are worth quoting in spirit: be the reference implementation for par2 handling, keep the readability of the reference open for all sorts of performance optimizations, and be usable as a library, of which the command line is one application.

The licence is GPL-2.0, with the COPYING file in the repository root. For a command line tool that ships as a binary, that is the usual choice for this class of software. For the library case, it is the point to check before you embed it, because a GPL library linked into a program has obligations for that program, and the answer depends on how you distribute it.

The lineage explains a lot about the code. OpenMP multithreading was originally developed by Jussi Kansanen in a separate repository, and the original development was done on Sourceforge but stalled. The current work happens in the parchive organisation, with the project page at parchive.github.io, which is also the place for details on the PAR 2.0 specification and discussion of all things PAR.

The release history shows active work rather than a frozen tree. Version 1.2.0 was released on 2026-06-10, 1.3.0 on 2026-08-15 and 1.4.0 on 2026-09-09, and the last push was on 2026-10-19. The repository also carries a ROADMAP file, a ChangeLog, an AUTHORS file and a valgrind.supp file, which tells you the project expects its own test runs to be checked under Valgrind.

## Conclusion

Adopt par2cmdline when you distribute files over unreliable media and want recipients to repair damage themselves without a full redundant copy, and skip it when you need encryption or a backup of the original, since PAR 2.0 recovery data is not a substitute for keeping the source. Verify first which par2 implementation your recipients already have, because the format is interoperable but the command line options are not, and build with the -DPAR2_BUILD_TOOL=OFF option if you only need the libpar2 library.

## FAQ

### How do I build par2cmdline on Linux?

Configure with cmake -B build-cmake -DCMAKE_BUILD_TYPE=Release, build with cmake --build build-cmake, run the tests with ctest --test-dir build-cmake and install with cmake --install build-cmake. With CMake 3.21 or later you can use the release preset instead.

### What is the difference between PAR 2.0 and PAR 1.0?

PAR 2.0 does not require splitting one large file into equal-sized pieces, has no efficiency loss across files of different sizes, needs only as much recovery data as the damage requires, can protect up to 32768 files against PAR 1.0's 256, and can use damaged recovery files during recovery. The cost is that creating recovery files takes somewhat longer than a PAR 1.0 program.

### How many recovery files can par2cmdline create?

The -n option documents a maximum of 31 recovery files, and the documentation warns not to combine -n with -l. Redundancy can also be set as a percentage with -r or as a target size with -r<c><n> where c is g, m or k.

### Can I use libpar2 without the command line program?

Yes. The project lists being usable as a library, of which the command line is one application, as a goal, and the build option -DPAR2_BUILD_TOOL=OFF builds only the library. The repository has include/ and src/ directories for the library code.

### What licence is par2cmdline released under?

The project is licensed under GPL-2.0, with the terms in the COPYING file at the repository root. Releases 1.2.0, 1.3.0 and 1.4.0 were published on 2026-06-10, 2026-08-15 and 2026-09-09 respectively, and the last push was on 2026-10-19.

## Sources

- [License: GPL-2.0](https://github.com/Parchive/par2cmdline/blob/master/LICENSE)
- [Parchive/par2cmdline on GitHub](https://github.com/Parchive/par2cmdline)
- [Project website](https://parchive.github.io)
- [README](https://github.com/Parchive/par2cmdline/blob/master/README.md)
- [Releases](https://github.com/Parchive/par2cmdline/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/parchive-par2cmdline
