Using PAR2 to generate parity information to use up the remaining space on a CD or DVD, to increase chances of recovering from minor discrot or scratches

A DVD has 2295104 2048-byte sectors. Expect to use around 2-4MB for the ISO/Joliet/Rock Ridge filesystem structures. More, if you have a ton of small files.

Usable data space is, roughly, 4,696,178,688 bytes.

I choose a parchive block size of 262144 bytes (256kB) to keep the block count low, and to keep the block size a multiple of a DVD or CD ECC group size (32kB) to minimize wasted space.

  • Collect the byte counts of the subsets to protect.
  • Compute the amount of free space remaining after all the subsets are accounted for.
  • Compute the percentage of each subset to the total amount used.
  • Split the free space amongst the subsets, so that each gets a quantity in relation to its percentage.
  • Compute the number of blocks each subset requires for parchive information.
  • Compute the parchive information for each subset.

    • par2 create -s262144 -c<parblks> -n1 -v -v <filename>.par2 <glob> <- Note the lack of spaces in parameters. It hates the spaces.

      • -s262144 - Block size
      • -c<parblks> - Number of recovery blocks to compute
      • -n1 - Place all recovery blocks in one file
      • -v - Make it whinier.
  • After computing all parchive info (you can remove non-parity par2 files), make the iso9660 filesystem

    • mkisofs -o image.iso -v -v -iso-level 4 -J -r -p 'CyberLeo' -V 'Image01' 01/

      • -o image.iso - Output image filename
      • -v Make it whinier.
      • -iso-level 4 - ISO9660-1999 with extensions most useful for modern systems (won't work on MS-DOS, et. al.)
      • -J - Add joliet information for Windows-based systems
      • -r - Add Rock Ridge information for Posix-based systems, and force values to more sane settings. (All files owned by root, readable by everyone, etc...)
      • -p 'CyberLeo' - Set the preparer ID string in the ISO header.
      • -V 'Image01' - Set the filesystem label