Date: Fri, 9 Jul 2010 21:21:24 +0000 From: Dmitry Lunts <eingorn777@gmail.com> To: freebsd-questions@freebsd.org Subject: RE:debugfs&FreeBSD Message-ID: <AANLkTimx_wchDAZfeUqxd-JvA2uyQ8QBgxliuuihsdUC@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
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
<SKIP>
$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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimx_wchDAZfeUqxd-JvA2uyQ8QBgxliuuihsdUC>
