[NTLUG:Discuss] Output to Multiple Files - Now More

Patrick R. Michaud pmichaud at pobox.com
Thu Apr 7 12:42:06 CDT 2005


On Thu, Apr 07, 2005 at 11:34:43AM -0500, Fred James wrote:
> David Wilson wrote:
> 
> >My goal is to capture a forensic image of a hard drive
> >to a dd type of file. I need to split it into chunks
> >(FAT32 limitation).  My process requires that I have
> >two copies of the files when complete.  I am trying to
> >save the time required to make a copy.  

> So maybe ...
> dd if=/dev/sdb | split -b 640m
> for i in `ls x??`
> do
>    cat $i | tee /path_1/$i /path_2/$i_2 2>&1 /dev/null
> done

I think David's purpose is to avoid the expense of reading
the image "twice" -- i.e., to be able to read it once and
write it to two places simultaneously.  Almost anything
involving split/cat means that everything is being read
twice.  Otherwise we could just do

   split -b 640m /dev/sdb
   cp x?? /path_1

which is basically the equivalent of the above but
requires that the contents are read twice.

I don't think split/tee (or the shell) are going to get David 
where he wants to go -- this might be a case where it's better to do 
things with a Perl script or a specialized C program designed
for the purpose.  

Pm




More information about the Discuss mailing list