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

Gilson Urbano Ferreira Dias gilsonurban at gmail.com
Thu Jul 21 15:00:36 CEST 2022


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 (Page 87)

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>
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
> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://listi.jpberlin.de/pipermail/smartmontools-support/attachments/20220721/65be5abb/attachment.htm>


More information about the Smartmontools-support mailing list