From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1815 invoked from network); 27 Jun 2023 04:43:51 -0000 Received: from minnie.tuhs.org (2600:3c01:e000:146::1) by inbox.vuxu.org with ESMTPUTF8; 27 Jun 2023 04:43:51 -0000 Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 0650240BB6; Tue, 27 Jun 2023 14:43:49 +1000 (AEST) Received: from lists.tip.net.au (pasta.tip.net.au [IPv6:2401:fc00:0:129::2]) by minnie.tuhs.org (Postfix) with ESMTPS id 0AAEC40B96 for ; Tue, 27 Jun 2023 14:43:40 +1000 (AEST) Received: from [192.168.1.5] (ppp118-208-161-109.cbr-trn-nor-bras39.tpg.internode.on.net [118.208.161.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailhost.tip.net.au (Postfix) with ESMTPSA id 4QqsY510cpz8sf4; Tue, 27 Jun 2023 14:43:36 +1000 (AEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) From: Steve Jenkin In-Reply-To: Date: Tue, 27 Jun 2023 14:43:35 +1000 Content-Transfer-Encoding: quoted-printable Message-Id: <30A876C5-8200-401F-A207-8DA31BEAE233@canb.auug.org.au> References: To: COFF X-Mailer: Apple Mail (2.3445.104.21) Message-ID-Hash: NNVOGHL6RBKIHVI4AWEIFPNGFUYNV5EA X-Message-ID-Hash: NNVOGHL6RBKIHVI4AWEIFPNGFUYNV5EA X-MailFrom: sjenkin@canb.auug.org.au X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [COFF] Re: Shell script advice: using 'dd' to write multiple media List-Id: Computer Old Farts Forum Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: > On 27 Jun 2023, at 09:32, Clem Cole wrote: >=20 > The trick here is understanding how ibs & obs, EOF is handled and = probably osync, then how to use iseek (iskip in modern versions). > It's not that hard. Its been done many times.=20 >=20 > One of the more interesting issues with dd is most versions still are = single threaded which sucks for most media - particularly f you want to = stream things. > There was a wonderful hack to dd done in the. early 1980s by Tapani = Lindgren ddd - double dd - which used two processes and a pipe to = control them, so one process was always reading while the other was = writing. You can one it Volume 14, issue 85 in the comp.sources.unix = archives. >=20 > Years ago, I hacked up a version using threads to do the same thing = with a mutex to protect everything (It ever ran on Windows at some = point).=20 > =E1=90=A7 Clem, Thanks very much for the note & comments. Of course, amongst the many fine things you=E2=80=99ve done, you=E2=80=99d written a proper, high-quality solution to this problem. I=E2=80=99d expect no less :) I take your point: =E2=80=98dd=E2=80=99 is a beast, very subtle with lots of = options. Very good idea to use =E2=80=98osync=E2=80=99 to pad the last = block written out to same size. [ I=E2=80=99ve never though to do that ] What I remember about the script is that =E2=80=98dd=E2=80=99 didn=E2=80=99= t have to be told the number of media to be written. It detected =E2=80=98End of File=E2=80=99 on the input (pipe) and = terminated the loop. It=E2=80=99s this action I=E2=80=99ve never solved. There were a few other things done in the body of the loop: writing to the operator the number of the media, to label it reading a response from /dev/tty, to allow the operator to = change media eg: read -p "OK? " resp