[smartmontools-support] Calcuting smartctl output to recovery bad-sector on FreeBSD ZFS

Christian Franke Christian.Franke at t-online.de
Thu Mar 11 15:10:27 CET 2021


Budi Janto wrote:
> I running FreeBSD 12.2-RELEASE and ZFS file system, my `dmesg` output 
> look like:
>
> Mar 11 18:45:36 BEC-STG-P1 kernel: (ada2:ahcich5:0:0:0): ATA status: 
> 41 (DRDY ERR), error: 40 (UNC )
> Mar 11 18:45:36 BEC-STG-P1 kernel: (ada2:ahcich5:0:0:0): RES: 41 40 30 
> 1f 90 00 b8 01 00 20 00
> Mar 11 18:45:36 BEC-STG-P1 kernel: (ada2:ahcich5:0:0:0): Error 5, 
> Retries exhausted
> Mar 11 18:45:42 BEC-STG-P1 kernel: (ada2:ahcich5:0:0:0): 
> READ_FPDMA_QUEUED. ACB: 60 20 28 1f 90 40 b8 01 00 00 00 00

With knowledge of the byte order used in "ACB: ..." above it should be 
possible to decode the LBA.


> ...
>
> root at BEC-STG-P1:~ # smartctl -l error /dev/ada2
> smartctl 7.2 2020-12-30 r5155 [FreeBSD 12.2-RELEASE-p2 amd64] (local 
> build)
> Copyright (C) 2002-20, Bruce Allen, Christian Franke, 
> www.smartmontools.org
>
> ...
> Error 2329 occurred at disk power-on lifetime: 14422 hours (600 days + 
> 22 hours)
>   When the command that caused the error occurred, the device was 
> active or idle.
>
>   After command completion occurred, registers were:
>   ER ST SC SN CL CH DH
>   -- -- -- -- -- -- --
>   40 51 00 ff ff ff 0f  Error: UNC at LBA = 0x0fffffff = 268435455
>
>   Commands leading to the command that caused the error were:
>   CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
>   -- -- -- -- -- -- -- --  ----------------  --------------------
>   60 00 30 ff ff ff 4f 00   1d+04:32:43.920  READ FPDMA QUEUED
>  ...

This is the legacy SMART error log which only supports 28-bit LBAs. This 
drive apparently logs the LBA registers as 0xff for LBAs greater than 
0x0fffffff. Other drives don't log anything in this case.

Don't use '-l error', use '-l xerror' instead. Note that '-l xerror' is 
not included in '-a' but in '-x'.

Try also '-l defects' which also included only in '-x'. If supported by 
the drive, this should print the LBAs of the 8 pending sectors counted 
in attribute 197/198.

Regards,
Christian



More information about the Smartmontools-support mailing list