USB Ram Stick

Julian H. Stacey jhs at flat.berklix.net
Wed Apr 26 19:58:44 UTC 2006


Oliver Fromme wrote:
> Julian H. Stacey <jhs at flat.berklix.net> wrote:
>  > Hi Oliver, cc list.
> 
> There's no need to send me a copy, I'm reading the list.
> I would prefer that you simply reply back to the list.
> Thanks.

OK.  I like a copy - so many threads & lists to skim.

>  > Oliver Fromme wrote:
>  > > Julian Stacey <jhs at berklix.org> wrote:
>  > > >   I wrote the image back to my identical stick (with dd), it wouldn't continue
>  > > >   writing after a while, (cant remember exact message).
>  > > 
>  > > The exact message would be very useful to know.
>  > 
>  > Lost, I was travelling at the time; either I saved it & then lost
>  > it after travel, or it was unsaved as boringly common, eg as in a
>  > message I just got:
>  >         dd: /dev/da0: Input/output error
> 
> Hmm ...  yes, most likely it was an "Input/output error", too.
> 
>  > I've sized several sticks of mine now you mention this, & they all
>  > come up short of nominal capacity.  (I'd wrongly expected a more
>  > conservative architecture, with extra blocks to be patched in as
>  > needed to retain nominal capacity).
> 
> Extra blocks cost extra money, I guess.  :-)
> 
> Given that prices have fallen considerably, the market on
> USB memory sticks is probably pretty tough, like the DRAM
> market.

Yes.

>  > > Did you try to clean it before?  i.e.
>  > > dd if=/dev/zero of=/dev/da0 count=100
>  > > (See the example in the bsdlabel(8) manpage.)
>  > 
>  > Yes, pretty sure I did, but did it again:
>  >         dd: /dev/da0: Input/output error
>  >         1+0 records in 0+0 records out 0 bytes transferred 
>  > same for dd if=/dev/zero of=/dev/da0 count=1
> 
> Not good.  Looks like a low-level problem (you also get a
> bunch of kernel error messages, I assume).

Yes, on insertion:
  kernel: umass0: Generic Flash Disk, rev 2.00/1.00, addr 3
  kernel: da0 at umass-sim0 bus 0 target 0 lun 0
  kernel: da0: <USB USB 2.0 Fash 1.00> Removable Direct Access SCSI-2 device 
  kernel: da0: 1.000MB/s transfers
  kernel: da0: 2038MB (4173824 512 byte sectors: 255H 63S/T 259C)

( BTW 2136997888 = 4173824 x 512, & source stick I copied from was 
      2138177536 so your guess of slightly smaller target stick correct).

  Then 4 of:
    {
    Then 4 of:
      {
      kernel: (da0:umass-sim0:0:0:0): READ(10). CDB: 28 0 0 0 0 1 0 0 1 0 
      kernel: (da0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
      kernel: (da0:umass-sim0:0:0:0): SCSI Status: Check Condition
      kernel: (da0:umass-sim0:0:0:0): MEDIUM ERROR asc:30,2
      kernel: (da0:umass-sim0:0:0:0): Cannot read medium - incompatible format
      kernel: (da0:umass-sim0:0:0:0): Retrying Command (per Sense Data)
      }
    Then 1 of
      {
      kernel: (da0:umass-sim0:0:0:0): READ(10). CDB: 28 0 0 0 0 1 0 0 1 0 
      kernel: (da0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
      kernel: (da0:umass-sim0:0:0:0): SCSI Status: Check Condition
      kernel: (da0:umass-sim0:0:0:0): MEDIUM ERROR asc:30,2
      kernel: (da0:umass-sim0:0:0:0): Cannot read medium - incompatible format
      kernel: (da0:umass-sim0:0:0:0): Retries Exhausted
      }
   }

> In such cases I usually try to add quirks for the device
> to /sys/cam/scsi/scsi_da.c.  According to my experience
> there's a good chance the device will work with a quirk.

Not sure this is [now] just a FreeBSD driver problems.  The slightly
larger 2G stick read to hard disc no problem.  Problem came on or
after writing back to the slightly smaller stick.  I'm wondering
if eg somehow the proprietary control page got scrambled so badly
it now thinks its doing 1024 or 256 byte sectors or something equally
weird - or maybe the RAM part just died & only the USB IC is answering.

( I tried reading the stick with Win-XP too, but no good:
  Win-XP is too clueless of course: half the clicks think there's
  no problem, & the other half give no clue what's wrong, doesnt
  report a device read error, let alone report an MBR unavailable,
  nor did XP offer to re MBR it, & DOS window with fdisk /mbr found
  no fdisk.  I loathe XP, but checked what I was doing with XP
  worked on a normal stick (to confirm it wasn't me failing with XP). )

Either this stick died of its own accord, or possibly FreeBSD did
something radical to it (though if so, & how is a mystery).

Thanks for the pointer to the quirk table.  
I used it in desperation to turn on all of 
	DA_Q_NO_SYNC_CACHE | DA_Q_NO_6_BYTE | DA_Q_NO_PREVENT
It didn't help make the stick useable though.  Still I get loads of
	(da0:umass-sim0:0:0:0): READ(10). CDB: 28 0 0 0 0 0 0 0 1 0
	(da0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
	(da0:umass-sim0:0:0:0): SCSI Status: Check Condition 
	(da0:umass-sim0:0:0:0): MEDIUM ERROR asc:30,2
	(da0:umass-sim0:0:0:0): Cannot read medium - incompatible format
	(da0:umass-sim0:0:0:0): Retrying Command (per Sense Data)
That Sony 2G stick is going back to vendor ! It cost 55 pounds = 79 Euro.

I learnt the quirk table though, detected a quirk in another stick &
submiting via send-pr (from my notes here:
  http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/sys/cam/scsi/
  http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/jhs/sys/cam/scsi/
So something useful came from the work, thanks for your help Oliver :-)
-- 
Julian Stacey.  Consultant Unix Net & Sys. Eng., Munich.  http://berklix.com
Mail in Ascii, HTML=spam.     Ihr Rauch = mein allergischer Kopfschmerz.


More information about the freebsd-scsi mailing list