[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dd of CD never ends


You have been very close to the solution all along.

Here is a tried-n-true method for creating an exact raw image of
the CD ROM disc. It has the advantage of being just two existing
utility commands, not requiring a 'port' (perhaps now missing) of
some toolset that may, or may not be current.......

Step #1

--  disklabel cd0 <cr>	- to get the true story on the disc
			  geometry, track and sector count.
			  Also you will note the 2048 byte size
			  for each block, typical of CD ROMs
			  (except old SunOS CDs...)

My local example here:

% disklabel cd0
# /dev/rcd0c:
type: ATAPI
disk: OpenBSD2.7 CD#1 
label: www.OpenBSD.org 
flags: removable
bytes/sector: 2048
sectors/track: 100
tracks/cylinder: 1
sectors/cylinder: 100
cylinders: 3251
total sectors: 325086
rpm: 300
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

3 partitions:
#        size   offset    fstype   [fsize bsize   cpg]
  a:   325086        0   ISO9660                        # (Cyl.    0 - 3250*)
  c:   325086        0   ISO9660                        # (Cyl.    0 - 3250*)

    Now that I know exactly the size of my CD ROM disc to copy, I can use
    the 'dd' command in much the way you were trying, but with some specifics
    that will assure an exact copy of each sector....with NO over-run.

Step #2

--  dd if=/dev/cd0c of=image.raw bs=100x2048 count=3251 <cr>

    The 'dd' utility goes off to read each track (100 blocks/track * 2048 bytes)
    for a count of 3251 cylinders ONLY.

Here are the results:

    3251+0 records in
    3251+0 records out
    665804800 bytes transferred in 1869.460 secs (356148 bytes/sec)

--  ll image.raw
    -rw-r--r--  1 root  randy  661299200 Dec 19 09:35 image.raw

I used the regular BLOCK device as my source. I override the default notion of
block size with the "bs=" argument, and I select a reasonable number of
blocks per transfer (via  bs=100x2048) to make the whole operation efficient.

This procedure is *not* designed to take the place of other, possibly more
appropriate methods of copying CD ROMs. It is just a way to get an *exact*
raw image of the CD ROM onto your hard disk drive.

I recently posted a similar solution for "Cloning Disk Drives" to an OpenBSD
mailing list. Perhaps you will find that useful as well.

Finally, CD ROMs are relatively slow (even for 40x or 50x drives). This operation
will take a while, so be patient.

Randy Lewis, RTMX


Phlucks wrote:
> I searched the archives for a solution to this, and I found at least one
> other person who had this problem, but a solution was never provided.
> When I am trying to make a cd image using dd, the image just keeps going
> and going.  I finally kill it around 1.5 gig.  I have tried this with many
> CDs and on 3 different machines.  I have tried the following commands:
> dd if=/dev/cd0c of=/path/img.iso
> dd if=/dev/cd0c of=/path/img.iso bs=2048
> dd if=/dev/cd0c of=/path/img.iso bs=512
> dd if=/dev/cd0c ibs=2048 of=path/img.iso obs=512
> Doesn't matter what I try, I still get a never-ending disk image.
> Is this a bug?  Or is there some other solution that nobody is posting
> online?
> TimH

Visit your host, monkey.org