|
From: Cristian K. <cr...@ne...> - 2007-04-02 13:11:49
|
Bruce Allen wrote: > Doug: could you please incorporate this into the document? > > Cristian: is there a way to identify what file is being overwritten with > a sector of zeros? Hi, Starting somewhere after FreeBSD 5.4 but before FreeBSD 6.2, fsdb(8) is able to map blocks to inodes. I think you can retrieve the file like this: (*command* is what you write) Step 1: Install fdisk-linux # *cd /usr/ports/sysutils/linuxfdisk* # *make install* Step 2: Find out which filesystem the sector occupies --- cut here --- # fdisk-linux /dev/ad2 # fdisk-linux -u /dev/ad2 The number of cylinders for this disk is set to 790272. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Command (m for help): *b* Reading disklabel of /dev/ad2s1 at sector 64. BSD disklabel command (m for help): *p* 8 partitions: # start end size fstype [fsize bsize cpg] c: 63 398283479 398283417 unused 0 0 d: 63 31457342 31457280 4.2BSD 2048 16384 28552 e: 31457343 398283479 366826137 4.2BSD 2048 16384 28552 BSD disklabel command (m for help): --- and here --- 64+63 (I think) is the start of the filesystem. This is the number you have to substract from the LBA and use in the next step. Step 3: Find the affected file. --- cut here --- # *fsdb -r /dev/ad2s1d* fsdb (inum: 2)> *findblk <block>* <block>: data block of inode <inum> fsdb (inum: 2)> *findblk <block>* fsdb (inum: 2)> *quit* # *find -inum <inum>* [file is returned] --- and here --- All the abose written is just theory and needs a lot of testing, but I assume it's a good start. For those who have fsdb(8) which does not support findblk: - make sure you have the FreeBSD source in /usr/src - copy the patch from http://lists.freebsd.org/pipermail/freebsd-hackers/2006-May/016588.html - paste it into a file (say fsdb.findblk.patch) - type patch < fsdb.findblk.patch - Patch will ask you to provide fsdb.8 and fsdb.c. The locations are /usr/src/sbin/fsdb/fsdb.8, /usr/src/sbin/fsdb/fsdb.c - cd /usr/src/sbin/fsdb && make && make install I hope this will help. > > Cheers, > Bruce > > > On Sun, 1 Apr 2007, Cristian KLEIN wrote: > >> Hi, >> >> Please include the following information somewhere on your site. It >> describes how to solve 'Current Pending Offline' problems on FreeBSD. If >> I had this information sooner, it would have saved me a lot of trouble. >> The following was tested on a FreeBSD 5.4, but should work on any >> FreeBSD > 5. >> >> Thank you very much, >> Cristi. >> >> --- cut here --- >> Suppose /dev/ad2 is failing a sector $x$. Do the following: >> >> root# sysctl kern.geom.debugflags=16 >> root# dd if=/dev/zero of=/dev/ad2 bs=512 count=1 oseek=$x$ >> root# sysctl kern.geom.debugflags=0 >> >> The first command enables writing directly to GEOM providers (your disk >> in this case). The second command overwrites the 'sick' sector with >> zeroes. The third command disables writing directly to GEOM providers >> (better be safe than sorry). >> --- and here --- >> >> >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to >> share your >> opinions on IT & business topics through brief surveys-and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> Smartmontools-support mailing list >> Sma...@li... >> https://lists.sourceforge.net/lists/listinfo/smartmontools-support |