Sujet : Re: Are We Back to the "Wars" Now ?
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.os.linux.miscDate : 23. Nov 2024, 23:04:17
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vhtjh0$1s5d5$11@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : Pan/0.161 (Chasiv Yar; )
On Sat, 23 Nov 2024 14:39:40 +0100, Carlos E.R. wrote:
I use named pipes on my backup script.
I dd a hard disk partition, compress it, and at the same time calculate
a checksum.
mkfifo mdpipe
dd if=/dev/$1 status=progress bs=16M | tee mdpipe | pigz -3 > $3.gz &
md5sum -b mdpipe | tee -a md5checksum_expanded
wait
rm mdpipe
echo "$3" >> md5checksum_expanded
This way there is only one disk read operation. I can see the thing
running at max hard disk speed.
Clever. Just one thing, I would probably use a dynamic name for the
pipe and put it in $TMPDIR (e.g. generated with tempfile) so that 1)
multiple instances could run at once, and 2) it doesn’t depend on
writing into the current directory, whatever that might be.
(It’s likely neither of those issues is relevant to your particular
use case ...)