Subject: dd strangeness
To: None <tech-kern@netbsd.org>
From: Tad Hunt <tad@entrisphere.com>
List: tech-kern
Date: 06/21/2002 14:20:30
I've got a NetBSD-1.5 system containing a IBM Microdrive with the
disklabel below.  When I enter the following command:

	# dd if=/dev/wd0d of=/dev/null bs=512

It runs fine for a long while, then at the end of the disk, I get a
bunch of these:

	wd0d: id not found reading fsbn 700560 of 700560-700567 \
		(wd0 bn 700560; cn 695 tn 0 sn 0), retrying
	...

	wd0d: id not found reading fsbn 700568 of 700568-700575 \
		(wd0 bn 700568; cn 695 tn 0 sn 8), retrying
	...

Why is dd attempting to read fsbn 700560 and 7700568, when the disk
ends at 700559 (see the disklabel)?

Is this the expected behavior?

dd(1) exits with an "Input/output error", this can't be right...

	dd: /dev/wd0d: Input/output error

Has anyone else ever seen this behavior?

I've tried this same thing with ATA flash disks other than the
Microdrive, and still see the same problem.

Manuel Boyer mentions here 

	http://mail-index.netbsd.org/port-i386/2001/04/18/0005.html

that there is a PR opened against this problem, but doesn't give
the PR number, and searching for "id not found" in the PR database
doesn't return any hits...  Searching the kern PR database for
"disk" hits upon this PR, which looks like what I'm seeing (except
the error messages contains different text).

	PR1238: Reading past end of IDE disk causes EIO, not EOF

I guess that this is what I'm running into.  Since it has been open
since 1995, I'm assuming it is not considered harmful?

-Tad

# disklabel wd0
# /dev/rwd0d:
type: ESDI
disk: IBM-DMDM-10340  
label: N20020603233351
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 695
total sectors: 700560
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

8 partitions:
#        size   offset     fstype   [fsize bsize   cpg]
  a:   288839        1     4.2BSD     1024  8192    16   # (Cyl.    0*- 286*)
  c:   288839   288840     4.2BSD     1024  8192    16   # (Cyl.  286*- 573*)
  d:   700560        0     unused        0     0         # (Cyl.    0 - 694)
  e:   122880   577679     4.2BSD     1024  8192    16   # (Cyl.  573*- 694*)
disklabel: boot block size 0
#