par2
Repair damaged files using parity volumes
TLDR
Create a parity archive with a set percentage level of redundancy
Create a parity archive with a chosen number of volume files (in addition to the index file)
Verify a file with a parity archive
Repair a file with a parity archive
SYNOPSIS
par2 [options] create [options] base_filename [files...]
par2 [options] verify [options] base_filename [files...]
par2 [options] repair [options] base_filename [files...]
PARAMETERS
--
Separates command-line options from filenames, useful if filenames start with a hyphen.
-r
Specifies the desired level of redundancy as a percentage (e.g., -r10 for 10% recovery blocks).
-s
Sets the recovery block size in bytes. Larger blocks are faster but less granular.
-b
Specifies the exact number of recovery blocks to create (alternative to -r).
-c
Limits the number of recovery files created by par2.
-l
Lists the contents of a .par2 file (blocks, files covered).
-v
Enables verbose output, showing more details about the process.
-q
Suppresses most output, showing only critical errors or results.
-h
Displays help information and usage instructions.
-N
(create mode) Specifies the number of volumes to split the original files into.
-R
(repair mode) Automatically renames repaired files (e.g., filename.corrupt to filename).
-a
(verify/repair mode) Automatically adds missing files from the current directory for consideration.
DESCRIPTION
par2 is a command-line utility used to protect files from corruption. It works by creating "parity files" (with .par2 extensions) which contain redundant information about the original data. If any of the original files become corrupted or are missing, these parity files can be used to recreate the lost data, provided enough parity data is available.
This is particularly useful for data transferred over unreliable networks (like Usenet binaries) or stored on potentially failing media. par2 calculates checksums and redundant blocks, allowing it to detect and repair even single-bit errors or entirely missing files from a set. It's an improvement over its predecessor, PAR (PAR1), offering better efficiency and robustness, especially with large numbers of files or complex corruption scenarios. Users typically create parity files for important data, then later use them to verify integrity or repair damaged files.
CAVEATS
- Resource Intensive: Creating parity files, especially for large datasets, can consume significant CPU and disk I/O resources and take a considerable amount of time.
- Disk Space: Parity files add to the total disk space required for your data. The amount depends on the redundancy level.
- Original Files Needed: par2 can only repair files if the original (or parts of the original) data is still available, along with sufficient parity data. It cannot recreate data from scratch using only parity files without any original data.
- Not for Security: par2 is designed for data integrity against accidental corruption or loss, not for protection against malicious tampering or encryption.
OPERATION MODES
par2 operates in three primary modes:
- create: Generates .par2 recovery files from a set of original files.
- verify: Checks the integrity of original files against existing .par2 recovery files.
- repair: Uses .par2 recovery files to rebuild or fix corrupted/missing original files.
FILE NAMING CONVENTION
par2 creates a base .par2 file (e.g., archive.par2) and several .volXXX+YY.par2 files (e.g., archive.vol000+01.par2), where XXX is the starting block and YY is the number of blocks in that volume. These volumes contain the actual recovery data.
HISTORY
par2 is the successor to the original PAR (Parity Archive Volume Set) format, often referred to as PAR1. PAR1, primarily developed by Tobias Richter, gained popularity for error correction of binary files distributed across Usenet newsgroups. However, PAR1 had limitations, particularly with large numbers of files, handling renamed files, and efficiency.
par2, developed by Peter Brian (often attributed to his pseudonym Parchive), addressed these shortcomings by introducing more advanced Reed-Solomon error correction algorithms, better file management, and improved performance, making it the de-facto standard for Usenet binary error recovery and general data integrity protection.