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

Franc Zabkar fzabkar at internode.on.net
Wed Jul 20 20:58:15 CEST 2022


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


More information about the Smartmontools-support mailing list