[comp.unix.i386] dd curiosity solution

mark@zok.UUCP (Mark W. Snitily) (01/02/90)

In article <592@junkyard.UUCP> joe@junkyard.UUCP (Joseph Sarkes) writes:
>In article <396@zok.UUCP>, mark@zok.UUCP (Mark W. Snitily) writes:
>> partition.  Noticed a large speed difference based upon the direction
>> of the I/O.
>> 
>> For example, if I write 4 sectors into the partition starting at sector
>> 20000, the write will complete very fast, (i.e. a few seconds):
>>       dd if=myfile of=/dev/rdsk/0p1 seek=20000 count=4
>> 
>> But, if I read 4 sectors from the partition starting at sector 20000,
>> the read will take forever to complete, (i.e. we're talking minutes to
>> hours depending upon the skip value):
>>       dd if=/dev/rdsk/0p1 of=myfile skip=20000 count=4
>
>dd skip= READS over the amount specified. See if your dd command has an
>option iseek= instead of using skip=.
>This should seek over the space instead of reading all of it.
>You can either use strings /bin/dd | grep iseek,
>or just try using the option and look for an error message.
>
>I understand that some raw devices also have problems seeking, so
>you may have better luck using iseek with a block device.
>
>Joseph Sarkes	(junkyard!joe)

Thank you Joseph Sarkes.  And thank you to everyone who emailed me or
posted followups to my original query.

For all of you out there running ISC's 386/ix 2.0.2 the correct
solution is (...drum roll...)

      the *undocumented* option "iseek=value".

The eariler example was "dd if=/dev/rdsk/0p1 of=myfile skip=20000  count=4".
When specified as       "dd if=/dev/rdsk/0p1 of=myfile iseek=20000 count=4"
the read from the partition completes immediately (instead of taking
many minutes of wall time).

By looking at the ascii strings in /bin/dd as Joseph suggested, came across
these interesting *undocumented* options:

   iseek=          seek on input file
   oseek=          seek on output file (same as the normal seek=)
   files=          ???
   conv=block      ???
   conv=unblock    ???

Once again curiosity strikes.  Anyone know what the files=, conv=block,
or conv=unblock options are?

I sure am looking forward to having accurate online manuals.  To anyone in
the know, will the man pages in 386/ix 2.2 document these useful dd options?

Once again, thanks to everyone.

Happy new year!

-- Mark

Mark W. Snitily                 Consulting Services:
894 Brookgrove Lane             Graphics, Operating Systems, Compilers
Cupertino, CA 95014             (408) 252-0456
mark@zok.uucp

djm@eng.umd.edu (David J. MacKenzie) (01/02/90)

In article <398@zok.UUCP> mark@zok.UUCP (Mark W. Snitily) writes:

   Once again curiosity strikes.  Anyone know what the files=, conv=block,
   or conv=unblock options are?

Assuming they're the same in System V as they are on SunOS 4.0, the
Sun manual has this to say about them:

     files=n	    Copy n input files before terminating  (makes
		    sense only when input is a magtape or similar
		    device).

	  block	    Convert  variable  length  records	to  fixed
		    length.
	  unblock   Convert  fixed  length  records  to	 variable
		    length.

     The block and unblock options cannot be  combined	with  the
     ascii,  ebcdic or ibm.  Invalid combinations silently ignore
     all but the last mutually-exclusive keyword.
--
David J. MacKenzie <djm@eng.umd.edu>

cpcahil@virtech.uucp (Conor P. Cahill) (01/02/90)

In article <398@zok.UUCP>, mark@zok.UUCP (Mark W. Snitily) writes:
>    files=          ???
>    conv=block      ???
>    conv=unblock    ???
> 
> Once again curiosity strikes.  Anyone know what the files=, conv=block,
> or conv=unblock options are?

	files=##	specifies the number of files to read from the 
			device (usefull for tape only)
	conv=block	convert varialbe length records (\n separated) to
			fixed length (1 rec/block) records
	conv=unblock	reverse of block


-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+