tech-kern archive

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

4K sector size (again) & cgd



Hello,

   I bought a new disk which included a warning label along the line of
"Warning: Uses 4K sector size!".

   I plugged it in, and NetBSD identifies it as:

umass0 at uhub6 port 1 configuration 1 interface 0
umass0: JMicron USB to ATA/ATAPI bridge, rev 2.00/1.00, addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <WDC WD75, 00AARX-00N0YB0, > disk fixed
sd0: 698 GB, 16383 cyl, 16 head, 63 sec, 4096 bytes/sect x 183143646 sectors

   disklabel identifies it as:
------------------------------
# /dev/rsd0d:
type: SCSI
disk: 00AARX-00N0YB0
label: fictitious
flags:
bytes/sector: 4096
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 16383
total sectors: 183143646
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0
[---]
------------------------------

   So far so good; I can add a slice, and run newfs on the slice.
However, I want to run cgd on it, and that's where the problems start. I
can configure a cgd device on the sd0a, but "disklabel cgd3" returns:

------------------------------
# /dev/rcgd3d:
type: cgd
disk: cgd
label: default label
flags:
bytes/sector: 512
sectors/track: 2048
tracks/cylinder: 1
sectors/cylinder: 2048
cylinders: 89425
total sectors: 183143646
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0

4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a: 183143646         0     4.2BSD      0     0     0  # (Cyl.      0 -
 89425*)
 d: 183143646         0     4.2BSD      0     0     0  # (Cyl.      0 -
 89425*)
disklabel: boot block size 0
disklabel: super block size 0
disklabel: partitions a and d overlap
------------------------------

   Whatever I try to do at this point, writing of the disklabel fails
(which I sort of expect, considering the discrepancies in the disklabel
outputs).

   cgd.c has:

------------------------------
        /*
         * XXX here we should probe the underlying device.  If we
         *     are accessing a partition of type RAW_PART, then
         *     we should populate our initial geometry with the
         *     geometry that we discover from the device.
         */
        pdg = &cs->sc_dksc.sc_geom;
        pdg->pdg_secsize = DEV_BSIZE;
        pdg->pdg_ntracks = 1;
        pdg->pdg_nsectors = 1024 * (1024 / pdg->pdg_secsize);
        pdg->pdg_ncylinders = cs->sc_dksc.sc_size / pdg->pdg_nsectors;
------------------------------

  .. which looks suspiciously ... suspicious. I'm assuming that fixing
that will increase the chances of the cgd device working properly on
this disk.

   Just so I don't waste a bunch of time poking in the wrong places; am
I looking at - what is likely - the problem?

   With regards to probing the underlying device: Any helpful pointers
to prior art is appreciated.

-- 
Kind regards,
Jan Danielsson



Home | Main Index | Thread Index | Old Index