Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dd to multiple outputs ?

310 views
Skip to first unread message

Guillaume Dargaud

unread,
May 5, 2003, 6:08:17 PM5/5/03
to
Hello all,
is there some way to have dd output to more than one file/device ?
I'd like to do something like that:
dd if=/dev/hdb of=/dev/hdc of=/dev/hdd of=/dev/hde
But this syntax won't work.

I though about using 'tee' but can't find a proper syntax:
dd if=/dev/hdb of=- | tee (some pipe to dd) | dd if=- of=/dev/hdc

I also thought about something like:
mkfifo f1 f2 f3
dd if=f1 of=/dev/hdc &
dd if=f2 of=/dev/hdd &
dd if=f3 of=/dev/hde &
dd if=/dev/hdb of=- | tee f1 f2 | f3
But it's the 1st time I try to use fifos and there must be something fully
wrong in my understanding of them.
--
Guillaume Dargaud
Colorado State University - Dept of Atmospheric Science
http://www.gdargaud.net/
"To ruin the net to save Disney is the equivalent of burning down the
library of Alexandria to save monastic scribes."

Rodrick Brown

unread,
May 5, 2003, 6:52:30 PM5/5/03
to
why not just use a for loop like
for i in /dev/hd[a-f] ; do dd if=/dev/$i of=/dev/$i ; done


"Guillaume Dargaud" <USENET...@gdargaud.net> wrote in message
news:3eb6...@news.ColoState.EDU...

Akop Pogosian

unread,
May 5, 2003, 8:44:25 PM5/5/03
to
Guillaume Dargaud <USENET...@gdargaud.net> wrote:
> Hello all,
> is there some way to have dd output to more than one file/device ?
> I'd like to do something like that:
> dd if=/dev/hdb of=/dev/hdc of=/dev/hdd of=/dev/hde
> But this syntax won't work.

> I though about using 'tee' but can't find a proper syntax:
> dd if=/dev/hdb of=- | tee (some pipe to dd) | dd if=- of=/dev/hdc

tee's argument can't be "some pipe to dd". Tee expects a file name
argument.


> I also thought about something like:
> mkfifo f1 f2 f3
> dd if=f1 of=/dev/hdc &
> dd if=f2 of=/dev/hdd &
> dd if=f3 of=/dev/hde &
> dd if=/dev/hdb of=- | tee f1 f2 | f3

dd if=/dev/hdb of=- | tee f1 f2 f3

is probably what you wanted to do here.

--
Akop Pogosian

This space has been accidentally left blank.

Barry Margolin

unread,
May 6, 2003, 10:40:37 AM5/6/03
to
In article <b970h9$2rom$1...@agate.berkeley.edu>,

Akop Pogosian <akopps...@ocf.berkeley.edu> wrote:
>> I also thought about something like:
>> mkfifo f1 f2 f3
>> dd if=f1 of=/dev/hdc &
>> dd if=f2 of=/dev/hdd &
>> dd if=f3 of=/dev/hde &
>> dd if=/dev/hdb of=- | tee f1 f2 | f3
>
>dd if=/dev/hdb of=- | tee f1 f2 f3
>
>is probably what you wanted to do here.

If you're using bash you can abbreviate this as:

dd if=/dev/hdb of=- | tee >(dd of=/dev/hdc) >(dd of=/dev/hdd) >(dd of=/dev/hde)

--
Barry Margolin, barry.m...@level3.com
Genuity Managed Services, a Level(3) Company, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

Bill Marcum

unread,
May 6, 2003, 5:44:16 PM5/6/03
to
On Mon, 5 May 2003 16:08:17 -0600, Guillaume Dargaud
<USENET...@gdargaud.net> wrote:
> Hello all,
> is there some way to have dd output to more than one file/device ?
> I'd like to do something like that:
> dd if=/dev/hdb of=/dev/hdc of=/dev/hdd of=/dev/hde
> But this syntax won't work.
>
> I though about using 'tee' but can't find a proper syntax:
> dd if=/dev/hdb of=- | tee (some pipe to dd) | dd if=- of=/dev/hdc
>
In the Gnu version of dd, you can simply omit "if=" or "of="
to use standard input and output.


--
bill marcum the mushroom-eating laboratory monkey
What kind of monkey are you? http://thesurrealist.co.uk/monkey.cgi

Guillaume Dargaud

unread,
May 7, 2003, 4:01:09 PM5/7/03
to
> If you're using bash you can abbreviate this as:
>
> dd if=/dev/hdb of=- | tee >(dd of=/dev/hdc) >(dd of=/dev/hdd) >(dd
> of=/dev/hde)
I didn't know this syntax. Interesting.

Although I found a simpler solution:
dd if=/dev/hdb | tee /dev/hdc /dev/hdd > /dev/hde

But it takes bloody forever to execute: I'm doing 6 drives at the same time
and I think it's gonna take about 12 hours. Haven't tried optimizing the
block size though.


--
Guillaume Dargaud
Colorado State University - Dept of Atmospheric Science
http://www.gdargaud.net/

"Seeing a murder on television...will help work off one's antagonisms. And
if you haven't any antagonisms, the commercials will give you some." —
Alfred Hitchcock

Carl Lowenstein

unread,
May 7, 2003, 11:49:58 PM5/7/03
to
In article <gumlo-...@don.localnet>,

Bill Marcum <bma...@iglou.com> wrote:
>On Mon, 5 May 2003 16:08:17 -0600, Guillaume Dargaud
> <USENET...@gdargaud.net> wrote:
>> Hello all,
>> is there some way to have dd output to more than one file/device ?
>> I'd like to do something like that:
>> dd if=/dev/hdb of=/dev/hdc of=/dev/hdd of=/dev/hde
>>
>> I though about using 'tee' but can't find a proper syntax:
>> dd if=/dev/hdb of=- | tee (some pipe to dd) | dd if=- of=/dev/hdc
>>
>In the Gnu version of dd, you can simply omit "if=" or "of="
>to use standard input and output.

In the 6th Edition Unix (1974) version of dd,


you can simply omit "if=" or "of="

to use standard input and output. So what else is new?

carl

--
carl lowenstein marine physical lab u.c. san diego
clow...@ucsd.edu

0 new messages