On Sun, Mar 09, 2003 at 12:57:11PM -0700, Bob Proulx wrote: > Osamu Aoki wrote: > > My post on this thread needs few errata: > > 1. CD image size can be obtained by "mount" the CD and run "df". > > Interesting. Thanks for educating us about that. > > > 2. Only "readcd" run with exact CD size can extract the correct image > > 3. "dd" tends to copy most data correct but loses last few KiB of data. > > I have been reading this thread with great interest because I had > determined the following behavior. > > cdrecord image-in.iso > dd if=/dev/cdrw of=image-out-cdrw.iso # works > cmp image-in.iso image-out-cdrw.iso # passes > > dd if=/dev/cdrom of=image-out-cdrom.iso # reports errors on last few kb > cmp image-in.iso image-outcdrom.iso # fails
Are you sure this is really just HW difference? See below. > The images compare exactly when being read from the cdrw drive. But > if I move the CD out of the writer that was used to write the image > and put it in a different CD reader only, not a writer, then the > repeat the dd then the image I retrieve is different and fails > compare. The last few kb of data is missing. The dd reports an I/O > error when trying to read those bytes on a cd reader only device. It > was fine on a cd writer device. ... OK, this prompted me to do more research. It looks somewhat complicated and it may be somewhat firmware dependent error handling issues involved. "cdtest" is a simple script shown below and "dd" is showing different result once error occurs. This memory effect erases once CD are ejected. ---[cdtest script]--- #!/bin/sh dd if=/dev/cdrom of=sarge-${1}-$((${1}/2048)) bs=2048 count=$((${1}/2048)) ls -l sarge-${1}-$((${1}/2048)) --- [EMAIL PROTECTED]:root# cdtest $((46301184)) dd: reading `/dev/cdrom': Input/output error 22564+0 records in 22564+0 records out 46211072 bytes transferred in 48.380704 seconds (955155 bytes/sec) -rw-r--r-- 1 root root 46211072 Mar 9 16:54 sarge-46301184-22608 [EMAIL PROTECTED]:root# cdtest $((46301184)) 22608+0 records in 22608+0 records out 46301184 bytes transferred in 53.311948 seconds (868495 bytes/sec) -rw-r--r-- 1 root root 46301184 Mar 9 16:55 sarge-46301184-22608 [EMAIL PROTECTED]:root# dd if=/dev/cdrom of=sarge-free-2ndhand 90436+0 records in 90436+0 records out 46303232 bytes transferred in 43.151651 seconds (1073035 bytes/sec) [EMAIL PROTECTED]:root# dd if=sarge-free-2ndhand of=sarge-free-46301184 bs=46301184 count=1 1+0 records in 1+0 records out 46301184 bytes transferred in 0.295885 seconds (156483718 bytes/sec) (... few more error free run of cdtest) [EMAIL PROTECTED]:root# ls -l sarge* -rw-r--r-- 1 root root 46301184 Mar 9 16:55 sarge-46301184-22608 -rw-r--r-- 1 root root 46301184 Mar 9 16:49 sarge-46302208-22608 -rw-r--r-- 1 root root 46303232 Mar 9 16:47 sarge-46303232-22609 -rw-r--r-- 1 root root 46303232 Mar 9 16:52 sarge-46401184-22656 -rw-r--r-- 1 root root 46303232 Mar 9 17:00 sarge-free-2ndhand -rw-r--r-- 1 root root 46301184 Mar 9 17:10 sarge-free-46301184 [EMAIL PROTECTED]:root# for xx in sarge* ; do cat $xx | md5sum ; done 65a9e488ddc9a9453685ca496af6e242 - 65a9e488ddc9a9453685ca496af6e242 - da940de4ad9a634b72e7c899322fd8a3 - da940de4ad9a634b72e7c899322fd8a3 - da940de4ad9a634b72e7c899322fd8a3 - 65a9e488ddc9a9453685ca496af6e242 - As you can see, once error free "dd" are established, "dd" return correct data with some (2048 for my drive but I think this should be HW dependent.) When "dd" errors, the data size seems significantly smaller. May be it drops entire data cache (either firmware level or Linux block read level, I have no idea.). So now I know, dd can be used to read image correctly once after CD are read with error and never ejected. Interesting. -- ~\^o^/~~~ ~\^.^/~~~ ~\^*^/~~~ ~\^_^/~~~ ~\^+^/~~~ ~\^:^/~~~ ~\^v^/~~~ +++++ Osamu Aoki <[EMAIL PROTECTED]> Cupertino CA USA, GPG-key: A8061F32 .''`. Debian Reference: post-installation user's guide for non-developers : :' : http://qref.sf.net and http://people.debian.org/~osamu `. `' "Our Priorities are Our Users and Free Software" --- Social Contract -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]