Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2020 21:59:25 +0100
From:      Miroslav Lachman <000.fbsd@quip.cz>
To:        Artem Kuchin <artem@artem.ru>, freebsd-fs@freebsd.org
Subject:   Re: Recovering bad sectors and smartctl no lba in error report
Message-ID:  <f2004707-3638-4e19-7dae-d54818bc58b8@quip.cz>
In-Reply-To: <dea482c2-838d-26d0-260b-b89c3b3864a5@artem.ru>
References:  <345b7285-958b-ef52-70a9-084872cf7409@artem.ru> <dea482c2-838d-26d0-260b-b89c3b3864a5@artem.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Artem Kuchin wrote on 2020/03/27 20:10:
> One more strange thing  i found out
> 
>> rror 5 occurred at disk power-on lifetime: 46151 hours (1922 days + 23 
>> 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 a0 08 de 3e 0b  Error: UNC at LBA = 0x0b3ede08 = 188669448
> 
> 
> The only error i saw in the log is about swap partition not redable.
> 
> However,
> 
> # gpart show
> 
> =>        34  5860533101  ada2  GPT  (2.7T)
>            34           6        - free -  (3.0K)
>            40         128     1  freebsd-boot  (64K)
>           168     8388608     2  freebsd-swap  (4.0G)
>       8388776  5852144352     3  freebsd-ufs  (2.7T)
>    5860533128           7        - free -  (3.5K)
> 
> Now see to which partition this LBA belongs. The block in the gpart show 
> are 512 b ytes and
> 
> LBA is 512 too. So, we can just compare numbers. And as you see 
> 188669448 is not in  the swap
> 
> partition. It is  in FREEBSD-UFS! So, some file is damaged there and i 
> need to know which one.
> 
> I need a way to map LBA (block) to a file. Linux has debugfs utility, 
> but i haven't found anything like that

I tried this few years ago. It is hard and not reliable to find file 
belonging to certain LBA.

fsdb findblk uses file system block sizes, smartctl LBA reports block in 
disk block sizes which can be 512 or 4k.
Then you need to substract partition offset etc.
One way to find the file is "guess". Read the given block by DD, open in 
editor and see the content of the file. Then you can guess what file it 
can be. In one case I found it was lighttpd.conf just by seeing the 
content of the file.
In other case it was empty space.

Miroslav Lachman



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f2004707-3638-4e19-7dae-d54818bc58b8>