f



imaging one disk partition to several disks

I want to copy a partition from one disk into
3 other disks simultaneously, like

ufsdump 0f - /dev/rdsk/c0d0s7 | (cd /disk2; ufsrestore xf -) &
ufsdump 0f - /dev/rdsk/c0d0s7 | (cd /disk3; ufsrestore xf -) &
ufsdump 0f - /dev/rdsk/c0d0s7 | (cd /disk4; ufsrestore xf -) &

but this makes 3 reads for every write, which I guess would slow
it down.

Is there a way to do _one_ ufsdump and 3 simultaneous ufsrestores?

(Solaris 9 x86 if that makes any difference)

Thanks

Oscar

0
Oscar
1/22/2004 4:23:21 PM
comp.unix.solaris 26025 articles. 2 followers. Post Follow

9 Replies
1210 Views

Similar Articles

[PageSpeed] 34

Oscar del Rio <delrio@mie.utoronto.ca> wrote:
> I want to copy a partition from one disk into
> 3 other disks simultaneously, like

> ufsdump 0f - /dev/rdsk/c0d0s7 | (cd /disk2; ufsrestore xf -) &
> ufsdump 0f - /dev/rdsk/c0d0s7 | (cd /disk3; ufsrestore xf -) &
> ufsdump 0f - /dev/rdsk/c0d0s7 | (cd /disk4; ufsrestore xf -) &

> but this makes 3 reads for every write, which I guess would slow
> it down.

Looks like it would make 1 read for every write to me, but I think you
want to read once and write 3 times.

> Is there a way to do _one_ ufsdump and 3 simultaneous ufsrestores?

I can't think of a way to do this in the shell itself.  You really need
something that will take the datastream, split it into 3 parts, then
feed it off to the ufsrestores.  You could probably write something in C
or perl without too much trouble, but you have some select issues to
worry about, and you have to keep track of how much data is actually
sent to the restore bits.

Personally, running 3 ufsdump/ufsrestore pairs doesn't sound too bad,
given the alternative.

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >
0
Darren
1/22/2004 5:31:38 PM
Darren Dunham wrote:
>>Is there a way to do _one_ ufsdump and 3 simultaneous ufsrestores?
> 
> I can't think of a way to do this in the shell itself.  You really need
> something that will take the datastream, split it into 3 parts, then
> feed it off to the ufsrestores.  You could probably write something in C
> or perl without too much trouble, but you have some select issues to
> worry about, and you have to keep track of how much data is actually
> sent to the restore bits.
> 
> Personally, running 3 ufsdump/ufsrestore pairs doesn't sound too bad,
> given the alternative.

Thanks, that's what I thought and that's what I'm doing.
Just thought there could be an easy shell trick to speed it up a bit
(something that would "tee" the stdout to the 3 ufsrestores, but
I don't think "tee" can do that).

0
Oscar
1/22/2004 5:48:48 PM
Oscar del Rio <delrio@mie.utoronto.ca> writes:

> Darren Dunham wrote:
>>>Is there a way to do _one_ ufsdump and 3 simultaneous ufsrestores?
>> I can't think of a way to do this in the shell itself.  You really need
>> something that will take the datastream, split it into 3 parts, then
>> feed it off to the ufsrestores.  You could probably write something in C
>> or perl without too much trouble, but you have some select issues to
>> worry about, and you have to keep track of how much data is actually
>> sent to the restore bits.
>> Personally, running 3 ufsdump/ufsrestore pairs doesn't sound too bad,
>> given the alternative.
>
> Thanks, that's what I thought and that's what I'm doing.
> Just thought there could be an easy shell trick to speed it up a bit
> (something that would "tee" the stdout to the 3 ufsrestores, but
> I don't think "tee" can do that).

According to tee(1) man page:

     tee - replicate the standard output

SYNOPSIS
     tee [-ai] [file...]

[snip]
     file  A path name of an output file.  Processing of at least
           13 file operands will be supported.

so it might be worth a trial.

Bye, Dragan

-- 
Dragan Cvetkovic, 

To be or not to be is true. G. Boole      No it isn't.  L. E. J. Brouwer

!!! Sender/From address is bogus. Use reply-to one !!!
0
Dragan
1/22/2004 6:01:14 PM
Dragan Cvetkovic wrote:
>>>>Is there a way to do _one_ ufsdump and 3 simultaneous ufsrestores?
>>>

>>Just thought there could be an easy shell trick to speed it up a bit
>>(something that would "tee" the stdout to the 3 ufsrestores, but
>>I don't think "tee" can do that).
> 
> 
> According to tee(1) man page:
> 
>      tee - replicate the standard output
> 
> SYNOPSIS
>      tee [-ai] [file...]
> 
> [snip]
>      file  A path name of an output file.  Processing of at least
>            13 file operands will be supported.
> 
> so it might be worth a trial.

I don't see how.
If instead of "files" tee could do "processes"...

0
Oscar
1/22/2004 6:15:57 PM
Oscar del Rio <delrio@mie.utoronto.ca> writes:

> Dragan Cvetkovic wrote:
>>>>>Is there a way to do _one_ ufsdump and 3 simultaneous ufsrestores?
>>>>
>
>>>Just thought there could be an easy shell trick to speed it up a bit
>>>(something that would "tee" the stdout to the 3 ufsrestores, but
>>>I don't think "tee" can do that).
>> According to tee(1) man page:
>>      tee - replicate the standard output
>> SYNOPSIS
>>      tee [-ai] [file...]
>> [snip]
>>      file  A path name of an output file.  Processing of at least
>>            13 file operands will be supported.
>> so it might be worth a trial.
>
> I don't see how.
> If instead of "files" tee could do "processes"...
>

Ooops, You are right. The above would just create 3 images at the same
time. What about some small C program that forks 3 children execing
ufsrestore? Or pipe(2)-ing its input into 3 ufsrestores?

Or setting a temp 4 way mirror using SVM and detaching the mirrors
after they resync.

An interesting problem anyway.

Bye, Dragan

-- 
Dragan Cvetkovic, 

To be or not to be is true. G. Boole      No it isn't.  L. E. J. Brouwer

!!! Sender/From address is bogus. Use reply-to one !!!
0
Dragan
1/22/2004 6:32:07 PM
Oscar del Rio <delrio@mie.utoronto.ca> wrote:
> 
> Is there a way to do _one_ ufsdump and 3 simultaneous ufsrestores?
> 

sure, as you are using pipes. just write program to create 3 (or as many as
you like) output pipes. but no, not standard solution beside dumping
to file and then start 3 restores.
 
toomas
-- 
When the only tool you have is a hammer, every problem starts to look
like a nail.
0
Toomas
1/22/2004 6:35:20 PM
Oscar del Rio <delrio@mie.utoronto.ca> writes:
> 
> I don't see how.
> If instead of "files" tee could do "processes"...

Use mknod to create a pipe (well, 2 pipes):

  mknod /tmp/p1
  mknod /tmp/p2

Then

  ufsdump .. | tee /tmp/p1 /tmp/p2 | ufsrestore xf - &
  ufsrestore xf /tmp/p1 &
  ufsrestore xf /tmp/p2 &

This will more or less throttle your dump to the speed of the fastest
disk being restored, but it may still be faster than using 3 ufsdumps.

-- Anton
0
Anton
1/22/2004 7:01:00 PM
Anton Rang wrote:

> Use mknod to create a pipe (well, 2 pipes):
> 
>   mknod /tmp/p1
>   mknod /tmp/p2
> 
> Then
> 
>   ufsdump .. | tee /tmp/p1 /tmp/p2 | ufsrestore xf - &
>   ufsrestore xf /tmp/p1 &
>   ufsrestore xf /tmp/p2 &

Thanks for the idea, it sounds good but somehow it did not work

The first ufsrestore fails with

resync restore, skipped 33 blocks
Warning: ./lost+found: File exists  (this is normal)
Warning: `.' missing from directory ./some/dir
Warning: `..' missing from directory ./some/dir
changing volumes on pipe input
abort? [yn] y
dump core? [yn] n

the other two restores (from the mknod pipes) fail with

resync restore, skipped 103 blocks
Cannot find file dump list

or

Volume is not in dump format

0
Oscar
1/22/2004 8:04:00 PM
Oscar del Rio <delrio@mie.utoronto.ca> wrote:
> Thanks, that's what I thought and that's what I'm doing.
> Just thought there could be an easy shell trick to speed it up a bit
> (something that would "tee" the stdout to the 3 ufsrestores, but
> I don't think "tee" can do that).

Hmm.  Well... now...

Tee can send to multiple files, so conceivably you could create a named
pipe in the filesystem, attach the three ufsrestores to them, and then
ufsdump to tee to the files.

It is conceivable that such would work.  It is entirely believable that
there would be a problem also.

mknod /tmp/restore1 p
mknod /tmp/restore2 p
cd /disk1; ufsrestore rf /tmp/restore1 &
cd /disk2; ufsrestore rf /tmp/restore2 &
ufsdump 0f - /dev/rdsk/whatever | tee /tmp/restore1 /tmp/restore2  | (cd /disk3 ufsrestore rf -)

maybe...
-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >
0
Darren
1/22/2004 10:12:10 PM
Reply: