Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
par2(1) 		      Parity archive utils			 par2(1)

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
     par2cmdline is a program for creating and using PAR2 files to detect damage
     in data files and repair them if necessary. It can be used with any kind of
     file.

OPTIONS
     -h     Show this help

     -V     Show version

     -VV    Show version and copyright

     -a <file>
	    Set  the  main  PAR2  archive name; required on create, optional for
	    verify and repair

     -b<n>  Set the Block-Count (default 2000 when neither -b nor -s  is  speci-
	    fied)

     -s<n>  Set the Block-Size (don't use both -b and -s)

     -r<n>  Level of redundancy (percentage, default 5%)

     -r<c><n>
	    Redundancy target size, <c>=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)

     -m<n>  Memory (in MB) to use (default is half of total physical memory)

     -t<n>  Number of threads used for main processing (default auto-detected)

     -T<n>  Number of files hashed in parallel (default 2)

     -v [-v]
	    Be more verbose

     -q [-q]
	    Be more quiet (-qq gives silence)

     -p     Purge  backup  files and par files on successful recovery or when no
	    recovery is needed

     -R     Recurse into subdirectories (only useful on create)

     -O     Rename-only mode (skip files that are not  perfect	matches,  useful
	    for quickly fixing renamed files)

     -N     data skipping (find badly mispositioned data blocks)

     -S<n>  Skip leaway (distance +/- from expected block position, default 64)

     -B<path>
	    Set the basepath to use as reference for the datafiles

     --     Treat all following arguments as filenames

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

     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
     With  PAR 2.0 you can create PAR2 recovery files for as few as 1 or as many
     as 32768 files. If you wanted to create PAR1 recovery files  for  a  single
     file  you	are forced to split the file into multiple parts and RAR is fre-
     quently used for this purpose. You do NOT need to split files with PAR 2.0.

     To create PAR 2 recovery files for a single  data	file  (e.g.  one  called
     test.mpg), you can use the following command:

       par2 create test.mpg

     If  test.mpg  is  an  800	MB file, then this will create a total of 8 PAR2
     files with the following filenames (taking roughly 6 minutes on a PC with a
     1500MHz CPU):

       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 posting
     on UseNet it is recommended that you use the "-s" option to set a blocksize
     that  is equal to the Article size that you will use to post the data file.
     If you wanted to post the test.mpg file using an article  size  of  300  KB
     then the command you would type is:

       par2 create -s307200 test.mpg

     This  will  create  9  PAR2 files instead of 8, and they will be capable of
     correcting up to 134 errors totalling 40 MB. It will take roughly 8 minutes
     to create the recovery files this time. In both of these two examples,  the
     total  quantity of recovery data created was 40 MB (which is 5% of 800 MB).
     If you wish to create a greater or lesser quantity of  recovery  data,  you
     can use the "-r" option. To create 10% recovery data instead of the default
     of  5%  and also to use a block size of 300 KB, you would use the following
     command:

       par2 create -s307200 -r10 test.mpg

     This would also create 9 PAR2 files, but they would be able to  correct  up
     to  269  errors  totalling 80 MB. Since twice as much recovery data is cre-
     ated, it will take about 16 minutes to do so with a 1500MHz CPU.  The  "-u"
     and "-n" options can be used to control exactly how many recovery files are
     created  and  how the recovery blocks are distributed amongst them. They do
     not affect the total quantity of recovery data created. The "-f" option  is
     used  when  you  create  additional recovery data. e.g. If you have already
     created 10% and want another 5% then you might use the following command:

       par2 create -s307200 -r5 -f300 test.mpg

     This specifies the same block size (which is a requirement  for  additional
     recovery files), 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 form multiple data files, you must  spec-
     ify the base filename to use for the par2 files and the names of all of the
     data  files.  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 files 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.

     With "-R" you can also create recovery  files  for  a  multi  layered  tree
     structure.

       .
       aaa aaaa-test.data
       aaa subdir1
       aA A  aaa test-0.data
       aaa subdir2
       aA A  aaa test-1.data
       aA A  aaa test-2.data
       aA A  aaa test-3.data
       aA A  aaa test-4.data
       aA A  aaa test-5.data
       aA A  aaa test-6.data
       aA A  aaa test-7.data
       aA A  aaa test-8.data
       aA A  aaa test-9.data
       aaa test-a.data

       par2 create -R recovery.par2 *

     Will result in:

       .
       aaa aaaa-test.data
       aaa recovery.par2
       aaa recovery.vol000+01.par2
       aaa recovery.vol001+02.par2
       aaa recovery.vol003+04.par2
       aaa recovery.vol007+08.par2
       aaa recovery.vol015+16.par2
       aaa recovery.vol031+32.par2
       aaa recovery.vol063+37.par2
       aaa subdir1
       aA A  aaa test-0.data
       aaa subdir2
       aA A  aaa test-1.data
       aA A  aaa test-2.data
       aA A  aaa test-3.data
       aA A  aaa test-4.data
       aA A  aaa test-5.data
       aA A  aaa test-6.data
       aA A  aaa test-7.data
       aA A  aaa test-8.data
       aA A  aaa test-9.data
       aaa 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.

     VERIFYING AND REPAIRING

     When  using  par2	recovery  files  to verify or repair the data files from
     which they were created, 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 will automatically search for the other par2  files  that  were
     created  and use the information they contain to determine the filenames of
     the original data files and then to verify them.  If all of the data  files
     are  ok,  then par2 will report that repair will not be required. If any of
     the data files are missing or damaged, par2 will report the details of what
     it has found. If the recovery files contain enough recovery blocks  to  re-
     pair  the	damage,  you will be told that repair is possible. Otherwise you
     will be told exactly how many recovery blocks will be required in order  to
     repair. To carry out a repair use the following command:

       par2 repair test.mpg.par2

     This  tells  par2	to  verify and if possible repair any damaged or missing
     files. If a repair is carried out, then each file which is repaired will be
     re-verified to confirm that the repair was successful.

     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 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 speci-
     fied in this way is an exact match for a data file, then the repair process
     will  rename  the file so that it has the correct filename. Because par2 is
     designed to be able to find good data within a damaged file, it can do  the
     same  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. If you do this then you may find that you can carry
     out a repair in a situation where you would not otherwise	have  sufficient
     recovery data. You can have par2 scan all files that are in the current di-
     rectory using a command such as:

       par2 r test.mpg.par2 *

     RENAME-ONLY MODE

     If  you  have  accidentally  renamed  many files that are protected by PAR2
     files, you can use the rename-only mode to quickly identify and  fix  them.
     In  rename-only  mode,  par2  will  skip files that are not perfect matches
     (i.e., files that are damaged or have mismatched blocks), which provides  a
     massive speedup when 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 will be	renamed  back  to  its	original
     name.  If	it's not a perfect match (e.g., the file is damaged), it will be
     skipped immediately without scanning the entire file.

     This is particularly useful when you have hundreds of gigabytes of  renamed
     files protected by multiple PAR2 sets, as it avoids the slow block-by-block
     scanning that would otherwise be required.

     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 that there is insufficient recovery data to effect a repair, you will
     be told that you need a certain number of recovery blocks. You  can  obtain
     these  by	downloading  additional  recovery files. In order to make things
     easy, par2 files have filenames that tell you  exactly  how  many	recovery
     blocks  each  one contains. Assuming that 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. If par2
     told  you	that  you  needed  10  recovery  blocks,  then	you  would  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  would
     have an extra 6 recovery blocks which would not be used for the repair).

     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 re-
     sult in worse performance. Four or more threads can be used for better per-
     formance 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>

1.1.1				  february 2026 			 par2(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=par2&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help