Docs/Installing Mandriva Linux/Iso Repair PAR2

From Mandriva Community Wiki

Jump to: navigation, search
ISO Download recovery with Parchive2 (PAR2)

Contents

[edit] What is a .par2?

Parchive2 tools check the integrity of and repair files from a set of parity files. Each parity files (.par2) contains a set of block parity. File names follow this scheme:

First a toc file:

<prefix>.par2

All parity files:

<prefix>-vol<block start>+<count of block>.par2

These files are created with different sizes to allow you to download only the number of blocks you need to recover data. The first file contains 1 block, the second 2 blocks, the third 4 blocks, and so on. This means that if you need 3 blocks, you can just download the files ending with +001.par2 and +002.par2.

[edit] Getting Parchive2

[edit] Mandriva Linux

Parchive2 is available as a Mandriva package in the contrib section. For information on setting up repositories and installing packages with the Mandriva packaging tools, see Installing and removing software.

[edit] Windows

See the QuickPar web page.

[edit] How do I use it?

Here's a step-by-step example with Mandriva Linux Discovery 2007 Spring.

The ISO is downloaded:

[nanardon@distrib-coffee discovery]$ ls -l
total 2195528
-rw-r--r-- 1 nanardon users 2248146944 avr 21 16:21 mandriva-linux-2007-spring-discovery-dvd-i586.iso
-rw-r--r-- 1 nanardon users         84 avr 21 16:06 mandriva-linux-2007-spring-discovery-dvd-i586.iso.md5
-rw-r--r-- 1 nanardon users        320 avr 21 16:06 mandriva-linux-2007-spring-discovery-dvd-i586.iso.md5.asc
-rw-r--r-- 1 nanardon users         92 avr 21 16:06 mandriva-linux-2007-spring-discovery-dvd-i586.iso.sha1
-rw-r--r-- 1 nanardon users        328 avr 21 16:06 mandriva-linux-2007-spring-discovery-dvd-i586.iso.sha1.asc
-rw-r--r-- 1 nanardon users      55989 avr 21 16:06 mandriva-linux-2007-spring-discovery-dvd-i586.lst

We can see my download is wrong: the size of the ISO is smaller than on the website. Testing the md5 will confirm that:

[nanardon@distrib-coffee discovery]$ md5sum -c mandriva-linux-2007-spring-discovery-dvd-i586.iso.md5
mandriva-linux-2007-spring-discovery-dvd-i586.iso: FAILED
md5sum: WARNING: 1 of 1 computed checksum did NOT match

[edit] Testing file integrity

To check the integrity with parchive tools you must put the par2 toc file in the same directory as my download file. In this case, it is named mandriva-linux-2007-spring-discovery-dvd-i586.par2.

Now you can test the download:

[nanardon@distrib-coffee discovery]$ par2verify mandriva-linux-2007-spring-discovery-dvd-i586.par2
[...]
Loading "mandriva-linux-2007-spring-discovery-dvd-i586.par2".
Loaded 14 new packets There are 6 recoverable files and 0 other files.
The block size used was 1136976 bytes.
There are a total of 2000 data blocks.
The total size of the data files is 2267983341 bytes.

Verifying source files: Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso" - damaged.
Found 1977 of 1995 data blocks.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso.md5" - found.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso.md5.asc" - missing.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso.sha1" - found.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso.sha1.asc" - found.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.lst" - found.

Scanning extra files: Repair is required.

1 file(s) are missing.
1 file(s) exist but are damaged.
4 file(s) are ok.

You have 1981 out of 2000 data blocks available.
Repair is not possible.
You need 19 more recovery blocks to be able to repair.

This shows that one file is missing and the ISO is wrong. More importantly, the last line tells you that 19 parity blocks are needed to recover the download.

[edit] Recovering the data

19 blocks are needed, so download 16 blocks plus 2 blocks plus 1 block:

[nanardon@distrib-coffee discovery]$ ls -l *.par2
-rw-r--r-- 1 nanardon users    41808 avr 21 16:36 mandriva-linux-2007-spring-discovery-dvd-i586.par2
-rw-r--r-- 1 nanardon users  1178852 avr 21 16:46 mandriva-linux-2007-spring-discovery-dvd-i586.vol0000+001.par2
-rw-r--r-- 1 nanardon users  2357604 avr 21 16:46 mandriva-linux-2007-spring-discovery-dvd-i586.vol0001+002.par2
-rw-r--r-- 1 nanardon users 18401344 avr 21 16:46 mandriva-linux-2007-spring-discovery-dvd-i586.vol0015+016.par2

Now you can try to recover the damaged files:

[nanardon@distrib-coffee discovery]$ par2repair mandriva-linux-2007-spring-discovery-dvd-i586.par2
[...]

Loading "mandriva-linux-2007-spring-discovery-dvd-i586.par2".
Loaded 14 new packets
Loading "mandriva-linux-2007-spring-discovery-dvd-i586.vol0000+001.par2".
Loaded 1 new packets including 1 recovery blocks
Loading "mandriva-linux-2007-spring-discovery-dvd-i586.vol0001+002.par2".
Loaded 2 new packets including 2 recovery blocks
Loading "mandriva-linux-2007-spring-discovery-dvd-i586.vol0015+016.par2".
Loaded 16 new packets including 16 recovery blocks
There are 6 recoverable files and 0 other files.
The block size used was 1136976 bytes.
There are a total of 2000 data blocks.

The total size of the data files is 2267983341 bytes. Verifying source files: Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso" - damaged. Found 1977 of 1995 data blocks.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso.md5" - found.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso.md5.asc" - missing.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso.sha1" - found.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso.sha1.asc" - found.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.lst" - found.

Scanning extra files:

Repair is required.
1 file(s) are missing.
1 file(s) exist but are damaged.
4 file(s) are ok.
You have 1981 out of 2000 data blocks available.
You have 19 recovery blocks available.
Repair is possible.
19 recovery blocks will be used to repair.

Computing Reed Solomon matrix.
Constructing: done. Solving: done.

Wrote 1761514656 bytes to disk
Wrote 506412192 bytes to disk

Verifying repaired files:
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso" - found.
Target: "mandriva-linux-2007-spring-discovery-dvd-i586.iso.md5.asc" - found.
Repair complete.

Now the repair is complete.

Personal tools