It's a nice idea to use fsck to control it. We really want par2 to be
multithreaded in CPU but single-threaded in disk I/O, and that would be
a way to do it. Unfortunately it doesn't look like par2 accepts input
pipes, which as you say makes things messy.
I also tried this (was it what you meant?):
$ mkfifo door
$ (cat input > door) & par2 create -c200 -n1 output door
But par2 doesn't seem to like named pipes as input either as it just
immediately exits. Maybe it likes to be able to seek its input.
I can't think of a simple way to do it simply and properly if we treat par2
as a black box program. But if the solution becomes too complicated,
then it would probably make more sense to look into a better replacement
for par2.
A while ago, it was suggested using zfec instead of (or as well as) par2.
(
https://groups.google.com/d/msg/bup-list/phdIVXCHygc/5nXtKpIk2c8J)
python-zfec is now in Debian stable, so it would be quite convenient to
use, and it is certainly faster.
I think it may have worse error-recovery properties though, because it
uses a smaller finite field than par2. That means (as far as I can see)
that for a given size of parity file, zfec can't cope with as many
randomly-distributed errors as par2. But zfec and par2 should do equally
well with contiguous errors. So when comparing speeds, it may be fairer
to increase the overhead for zfec to compensate for this.
On the other hand, I'd guess the current 10% overhead (100MB parity file
for a 1GB pack file) gives plenty of error recovery. This (using par2)
should cope with up to 100MB of errors (in the best case), or a
randomly-distributed 6% of its ~450k blocks being bad which is quite a
big error rate. You can imagine a hard disk might rarely have a bit
error affecting a single block, possibly due to a RAM error, or it may
completely die altogether, but I don't know what kind of fault would
lead to 6% of blocks going bad. (So maybe there is a case for lowering
the current overhead from 10%.)