From owner-freebsd-questions@FreeBSD.ORG Fri Jul 9 21:21:26 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B55981065760 for ; Fri, 9 Jul 2010 21:21:26 +0000 (UTC) (envelope-from eingorn777@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7D6CC8FC14 for ; Fri, 9 Jul 2010 21:21:26 +0000 (UTC) Received: by iwn35 with SMTP id 35so3269413iwn.13 for ; Fri, 09 Jul 2010 14:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=5chc9fuuAPfejt/gsIoV9BDp1aW7zpG2HfcluHNNdt8=; b=CaGH6Dd9Rgg7zbQBRg2q6OUdQHwzVJQAdGpg5ORCxMlxtJhLKhImRbluw7MtRPPOXY rp333GNk6dnVytsoGNLw5NCuELXK8nxxzytIz9/gVcYWn3YNumkEOEzwHhpQyCV1bZ+e tlWNBkAq70BT4DVEOnZmvC2lP0URbry512ALQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=nOYhDF7EbXopK3rMe7bmp8wwrEc/Lt+mQVnHHipGVYW5naJU6h/BdBV6FIyHvhmd92 QyRQnbZQn89fI1u2u+ynMObUf4hRAVFLJ7wpIuI/w5s3B7SpHYFLYya6KGyAmnXkO+sN bPn5P5xCrVr0UySH6kFzDScaU8/kCxM4Mbj+Q= MIME-Version: 1.0 Received: by 10.231.193.135 with SMTP id du7mr10001938ibb.176.1278710484612; Fri, 09 Jul 2010 14:21:24 -0700 (PDT) Received: by 10.231.35.133 with HTTP; Fri, 9 Jul 2010 14:21:24 -0700 (PDT) Date: Fri, 9 Jul 2010 21:21:24 +0000 Message-ID: From: Dmitry Lunts To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: RE:debugfs&FreeBSD X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2010 21:21:26 -0000 Thanks for your responses! fsdb really works. The event sequence was as follows: $sudo smartctl -t long /dev/ad6 $sudo smartctl -l selftest /dev/ad6 Num Test_Description Status Remaining ... LBA_of_first_error # 1 Extended offline Completed: read failure 90% 7376 ... 4007967 $sudo bsdlabel ad6s1 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 1048576 0 4.2BSD 2048 16384 8 b: 1048576 1048576 swap c: 100663227 0 unused 0 0 # "raw" part, don'= t edit d: 2097152 2097152 4.2BSD 2048 16384 28552 e: 655360 4194304 4.2BSD 2048 16384 40968 f: 37748736 4849664 4.2BSD 2048 16384 28552 g: 58064827 42598400 4.2BSD 2048 16384 28552 >From the above output one can conclude that bad sector (LBA_of_first_error=3D4007967) lies in the partition ad6s1d, which in my case is mounted to /var (from fstab) Further: $fsdb -r /dev/ad6s1d Bad sector offset within /var is LBA_of_first_error-62-offset_of_partition_d=3D 4007967-63-2097152=3D1910752 so, next step: fsdb (inum: 2)> findblk 1910752 1910752: data block of inode 117934 fsdb (inum: 117934)> inode 117934 current inode: regular file I=3D117934 MODE=3D100644 SIZE=3D53609 BTIME=3DJul 1 20:10:54 2010 [0 nsec] MTIME=3DJul 1 20:10:54 2010 [0 nsec] CTIME=3DJul 1 20:10:54 2010 [0 nsec] ATIME=3DJul 10 00:33:55 2010 [0 nsec] OWNER=3Droot GRP=3Dwheel LINKCNT=3D1 FLAGS=3D0 BLKCNT=3D6c GEN=3D8c5ac7e fsdb (inum: 117934)>blocks Blocks for inode 117934: Direct blocks: 477680, 477688, 477696, 477848 (3 frags) First fragment FSBlock (477688) when multiplied by 4 gives me exactly 1910752. i.e. LBA_of_first_error (4 is fsbtodb param from the output of ffsinfo -l 1 /dev/ad6s1d) Next I search for defect file: $ sudo find /var -inum 117934 /var/db/pkg/kdeutils-3.5.10_5/+CONTENTS And what's more: when I try to upgrade some port or simply issue the command $sudo pkgdb -uF I get this error: Input/Output error - /var/db/pkg/kdeutils-3.5.10_5/+CONTENTS wich corresponds exactly with what was previousely discovered by means of "smartctl", "fsdb" and "find". Just one more question (maybe a bit stupid): if I try to remap bad sector(s= ) in /var/db/pkg with, for instance, dd if=3D/dev/zero of=3D/dev/ad6 bs=3D512 count=3D1 seek=3D1910752 can I cosequently safely restore pkgdb with pkgdb -uF? TIA =D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC, =D0=94=D0=BC= =D0=B8=D1=82=D1=80=D0=B8=D0=B9 Best regards, Dmitry email: eingorn777@gmail.com