From owner-freebsd-fs@freebsd.org Fri Mar 27 20:59:46 2020 Return-Path: Delivered-To: freebsd-fs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 881222613CC for ; Fri, 27 Mar 2020 20:59:46 +0000 (UTC) (envelope-from SRS0=pb5C=5M=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [94.124.105.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48pvP46nhdz4TYR for ; Fri, 27 Mar 2020 20:59:36 +0000 (UTC) (envelope-from SRS0=pb5C=5M=quip.cz=000.fbsd@elsa.codelab.cz) Received: from elsa.codelab.cz (localhost [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 479BC28416; Fri, 27 Mar 2020 21:59:27 +0100 (CET) Received: from illbsd.quip.test (ip-62-24-92-232.net.upcbroadband.cz [62.24.92.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 3A1CE2840C; Fri, 27 Mar 2020 21:59:26 +0100 (CET) Subject: Re: Recovering bad sectors and smartctl no lba in error report To: Artem Kuchin , freebsd-fs@freebsd.org References: <345b7285-958b-ef52-70a9-084872cf7409@artem.ru> From: Miroslav Lachman <000.fbsd@quip.cz> Message-ID: Date: Fri, 27 Mar 2020 21:59:25 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.3 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 48pvP46nhdz4TYR X-Spamd-Bar: ++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of SRS0=pb5C=5M=quip.cz=000.fbsd@elsa.codelab.cz has no SPF policy when checking 94.124.105.4) smtp.mailfrom=SRS0=pb5C=5M=quip.cz=000.fbsd@elsa.codelab.cz X-Spamd-Result: default: False [4.03 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; IP_SCORE(0.83)[ip: (0.30), ipnet: 94.124.104.0/21(0.15), asn: 42000(3.63), country: CZ(0.09)]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[quip.cz]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.99)[0.995,0]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[4.105.124.94.list.dnswl.org : 127.0.10.0]; NEURAL_SPAM_LONG(1.00)[0.998,0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[000.fbsd@quip.cz,SRS0=pb5C=5M=quip.cz=000.fbsd@elsa.codelab.cz]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:42000, ipnet:94.124.104.0/21, country:CZ]; FROM_NEQ_ENVFROM(0.00)[000.fbsd@quip.cz,SRS0=pb5C=5M=quip.cz=000.fbsd@elsa.codelab.cz]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Mar 2020 20:59:46 -0000 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