All of lore.kernel.org
 help / color / mirror / Atom feed
* how to "decode" SG_IO: bad/missing sense data?
@ 2015-06-16 11:05 Tom Yan
  2015-06-16 11:24 ` Douglas Gilbert
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Yan @ 2015-06-16 11:05 UTC (permalink / raw)
  To: linux-scsi, linux-ide

When I "ATA Secure Erase" a USB Flash Drive, I got:

SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 40 00 0a 00 00 00
00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

While the erase seems to work without bricking the device (multiple
trials with shred and hexdump), this message still bothers me a bit.
So is there anyway I could "decode" it so that I can know what it
actually means?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to "decode" SG_IO: bad/missing sense data?
  2015-06-16 11:05 how to "decode" SG_IO: bad/missing sense data? Tom Yan
@ 2015-06-16 11:24 ` Douglas Gilbert
  2015-06-16 15:58   ` Tom Yan
  0 siblings, 1 reply; 3+ messages in thread
From: Douglas Gilbert @ 2015-06-16 11:24 UTC (permalink / raw)
  To: Tom Yan, linux-scsi, linux-ide

On 15-06-16 01:05 PM, Tom Yan wrote:
> When I "ATA Secure Erase" a USB Flash Drive, I got:
>
> SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 40 00 0a 00 00 00
> 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>
> While the erase seems to work without bricking the device (multiple
> trials with shred and hexdump), this message still bothers me a bit.
> So is there anyway I could "decode" it so that I can know what it
> actually means?

Hi,
Install the sg3_utils package then copy that hex sequence and place
it after the sg_decode_sense command. In this case:

$ sg_decode_sense f0 00 01 00 50 40 00 0a 00 00 00 00 00 1d 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00
  Fixed format, current;  Sense key: Recovered Error
  Additional sense: ATA pass through information available
   error=0x0, status=0x50, device=0x40, sector_count(7:0)=0x0
   extend=0, log_index=0x0, lba_high,mid,low(7:0)=0x0,0x0,0x0

So that ATA Secure Erase command is sending a SCSI error back
through the SAT mechanism. Check the SAT standard (at www.t10.org)
for details.

Doug Gilbert




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to "decode" SG_IO: bad/missing sense data?
  2015-06-16 11:24 ` Douglas Gilbert
@ 2015-06-16 15:58   ` Tom Yan
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Yan @ 2015-06-16 15:58 UTC (permalink / raw)
  To: dgilbert; +Cc: linux-scsi, linux-ide

I knew both sg_decode_sense and the SAT spec, but I didn't think of
using them together to decode this. (Didn't bother to download the
spec as well because it requires a bit of "registration" :P) Thanks
for the pointer.

According to the latest draft, if "CK_COND" is set to 1, the sense
data returned will be:

"No error, successful completion or command in progress. The SATL shall
terminate the command with CHECK CONDITION status with the sense key
set to RECOVERED ERROR with the additional sense code set to ATA
PASS-THROUGH INFORMATION AVAILABLE (see SPC-4)."

though I do not find anything useful to further decode the additional
fields like "status=0x50". (Some google results did tell me that 50
means success.)

The man page of sg_sat_identify also mentioned a bit about it:

       -c, --ck_cond
              sets  the CK_COND bit in the ATA PASS-THROUGH SCSI cdb.
The default setting is clear (i.e. 0). When set the SATL should yield
a sense buffer containing a ATA Result descriptor irrespective of
              whether the command succeeded or failed. When clear the
SATL should only yield a sense buffer containing a ATA Result
descriptor if the command failed.

When I run `sg_sat_identify` with `-c` to my different drives, the
drive which makes hdparm gives the SG_IO error seems to be the only
one actually respond to the "CK_COND" bit:

[tom@localhost ~]$ sudo sg_sat_identify -c /dev/sdb
expected descriptor sense format, response code=0xf0

others simply reacts as if the bit is not set.

Anyway the SG_IO error is given by hdparm, so I guess I should talk to
the hdparm guys now.

On 16 June 2015 at 19:24, Douglas Gilbert <dgilbert@interlog.com> wrote:
> On 15-06-16 01:05 PM, Tom Yan wrote:
>>
>> When I "ATA Secure Erase" a USB Flash Drive, I got:
>>
>> SG_IO: bad/missing sense data, sb[]:  f0 00 01 00 50 40 00 0a 00 00 00
>> 00 00 1d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>>
>> While the erase seems to work without bricking the device (multiple
>> trials with shred and hexdump), this message still bothers me a bit.
>> So is there anyway I could "decode" it so that I can know what it
>> actually means?
>
>
> Hi,
> Install the sg3_utils package then copy that hex sequence and place
> it after the sg_decode_sense command. In this case:
>
> $ sg_decode_sense f0 00 01 00 50 40 00 0a 00 00 00 00 00 1d 00 00 00 00 00
> 00 00 00 00 00 00 00 00 00 00 00 00 00
>  Fixed format, current;  Sense key: Recovered Error
>  Additional sense: ATA pass through information available
>   error=0x0, status=0x50, device=0x40, sector_count(7:0)=0x0
>   extend=0, log_index=0x0, lba_high,mid,low(7:0)=0x0,0x0,0x0
>
> So that ATA Secure Erase command is sending a SCSI error back
> through the SAT mechanism. Check the SAT standard (at www.t10.org)
> for details.
>
> Doug Gilbert
>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-16 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-16 11:05 how to "decode" SG_IO: bad/missing sense data? Tom Yan
2015-06-16 11:24 ` Douglas Gilbert
2015-06-16 15:58   ` Tom Yan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.