Parchive is an erasure code system which produces par files for data integrity verification with the ability to recover / repair corrupted and missing data.
$ sudo apt install par2
$ git clone https://github.com/Parchive/par2cmdline
$ cd par2cmdline
$ ./automake.sh
$ ./configure
$ make
$ make check
$ make install
- -n1 : Only create 1 par2 file (besides index).
- -r5 : Create redundancy of 5%. Set higher if file importance is higher.
$ par2 c -n1 -r5 <file>
$ find <path> -type f -not -name "*.par2" -exec par2 c -n1 -r5 {} \;
$ par2 v <file>.par2
$ find <path> -type f -name "*.par2" -exec par2 v {} \;
$ par2 r <file>.par2
$ find <path> -type f -not -name "*.par2" -exec par2 c -n1 -r5 {} \;
$ rsync -avR --remove-source-files --include="*.par2" --exclude="par2/" --include="*/" --exclude="*" <basepath>/ <basepath>/par2/
Run in base directory with par2 directory.
#!/bin/bash
IFS=$'\n'
for x in $(find "par2" -type f -name "*.par2")
do
par2 v -q -B "$(dirname "${x#par2/}")" "${x}"
done