[smartmontools-support] How to fake an error to test the short/long test detection capability of smartctl?

Franc Zabkar fzabkar at internode.on.net
Thu Jul 21 18:57:59 CEST 2022


I think you will find that READ/WRITE LONG have been retired from the 
ATA standard. In fact, even in those drives that still support these 
commands, the result can be junk data, so it would be inadvisable to use 
them.

See Response #5:

https://www.deepspar.com/blog/Read-Ignoring-ECC.html

Here is a real example:

https://www.recoveryforce.com/spinrite-a-data-recovery-program/

Presumably Spinrite uses the READ LONG command, and this is probably the 
reason that it sometimes returns junk data.

-Franc


On 21/07/2022 11:00 pm, Gilson Urbano Ferreira Dias wrote:
> Franc,
> 
> Thanks for the useful information.
> 
> Just for documentation purposes on the mailing list, I figure out that 
> the similar commands for SCSI are WRITE LONG (10) and WRITE LONG (16).
> 
> https://www.t10.org/ftp/t10/document.05/05-344r0.pdf 
> <https://www.t10.org/ftp/t10/document.05/05-344r0.pdf> (Page 87)
> 
> https://linux.die.net/man/8/sg_write_long 
> <https://linux.die.net/man/8/sg_write_long>
> 
> Regards,
> 
> Gilson Urbano
> 
> On Wed, Jul 20, 2022 at 9:03 PM Franc Zabkar <fzabkar at internode.on.net 
> <mailto:fzabkar at internode.on.net>> wrote:
>  >
>  > The ATA standard provides a Write Uncorrectable Ext command for this
>  > purpose. A pseudo-uncorrectable sector is created.
>  >
>  > --------------------------------------------------
>  > 7.66.2.2 Pseudo Uncorrectable Logical Sectors
>  >
>  > If the FEATURE field (7:0) contains a value of 55h, the WRITE
>  > UNCORRECTABLE EXT command shall cause the device to indicate a failure
>  > when subsequent reads to any of the logical sectors that are contained
>  > in the physical block of the specified logical sector are performed.
>  > These logical sectors are referred to as pseudo uncorrectable logical
>  > sectors. Whenever a pseudo uncorrectable logical sector is accessed via
>  > a read command the device shall perform normal error recovery to the
>  > fullest extent until:
>  >
>  > a) the error recovery process is completed, the UNCORRECTABLE ERROR bit
>  > is set to one, and the ERROR bit is set to one; or
>  >
>  > b) a command time-out that applies to error recovery control occurs
>  > before error recovery is completed and an error is reported as a result
>  > of the command time-out (see 8.3.3).
>  >
>  > As part of reading a pseudo uncorrectable logical sector, the device
>  > shall perform error logging (e.g., SMART, device statistics) in the same
>  > manner as an Uncorrectable error (see 6.3.6).
>  > --------------------------------------------------
>  >
>  > 7.66.2.3 Flagged Uncorrectable Logical Sectors
>  >
>  > If the FEATURE field (7:0) contains a value of AAh, the WRITE
>  > UNCORRECTABLE EXT command shall cause the device to mark the specified
>  > logical sectors as flagged uncorrectable. Marking a logical sector as
>  > flagged uncorrectable shall cause the device to indicate a failure when
>  > subsequent reads to the specified logical sector are processed.
>  >
>  > As part of reading a flagged uncorrectable logical sector, the device
>  > should not perform error logging (e.g., SMART, device statistics) in the
>  > same manner as an Uncorrectable error (see 6.3.6).
>  > --------------------------------------------------
>  >
>  > On 21/07/2022 12:06 am, Gilson Urbano Ferreira Dias wrote:
>  > > Hi,
>  > >
>  > > I would like to know what is the best/correct approach to fake/mock an
>  > > error to test the detection capability of smartctl.
>  > >
>  > > Regards,
>  > >
>  > > Gilson Urbano
>  > >
>  > > _______________________________________________
>  > > Smartmontools-support mailing list
>  > > Smartmontools-support at listi.jpberlin.de 
> <mailto:Smartmontools-support at listi.jpberlin.de>
>  > > https://listi.jpberlin.de/mailman/listinfo/smartmontools-support 
> <https://listi.jpberlin.de/mailman/listinfo/smartmontools-support>
>  > _______________________________________________
>  > Smartmontools-support mailing list
>  > Smartmontools-support at listi.jpberlin.de 
> <mailto:Smartmontools-support at listi.jpberlin.de>
>  > https://listi.jpberlin.de/mailman/listinfo/smartmontools-support 
> <https://listi.jpberlin.de/mailman/listinfo/smartmontools-support>
> 
> _______________________________________________
> Smartmontools-support mailing list
> Smartmontools-support at listi.jpberlin.de
> https://listi.jpberlin.de/mailman/listinfo/smartmontools-support


More information about the Smartmontools-support mailing list