From owner-freebsd-fs Mon Oct 29 10:20:30 2001 Delivered-To: freebsd-fs@freebsd.org Received: from InterJet.elischer.org (c421509-a.pinol1.sfba.home.com [24.7.86.9]) by hub.freebsd.org (Postfix) with ESMTP id D9E3537B401 for ; Mon, 29 Oct 2001 10:20:26 -0800 (PST) Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id KAA26376; Mon, 29 Oct 2001 10:00:35 -0800 (PST) Date: Mon, 29 Oct 2001 10:00:33 -0800 (PST) From: Julian Elischer To: Alexander Leidinger Cc: fs@freebsd.org Subject: Re: physical block no -> name of file (FFS)? In-Reply-To: <200110291328.f9TDSGE04238@Magelan.Leidinger.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org you would need to start with 'fsck' and add an option to specify a block to watch for (partiton relative). fsck -n -B NUM could easily return an inode number for you and a filename too given enough hacking... Shuould not be toooo difficult, so as you have the itch, if you scratch it, we can take the patches and put them back in so that the next person can do this easier.. julian On Mon, 29 Oct 2001, Alexander Leidinger wrote: > Hi, > > [Please keep me in the CC] > > I've a bad block on a harddisk and want to know the name of the file > which the bad block is a part of (to replace the file from a backup > after writting zeros to the block to remap the block). > > At http://www.leidinger.net/FreeBSD/b2i.c I've a quick hack which is > able to find the slice and partition which contains the bad block, but I > don't know what to do now. > > The idea I have is: > - find the dinode which has a relationship to the bad block > - find the corresponding directory entry > - print the name > > But I don't know enough about the ffs to do this, what FM should I read > to be able to do this (online or basesystem documentation prefered over > dead wood docs)? > > My main problem at the moment is: how does the on disk layout look like? > I tried a little bit in b2i.c (state_superblock & state_dinode), but I > think this is wrong. > > Bye, > Alexander. > > -- > Loose bits sink chips. > > http://www.Leidinger.net Alexander @ Leidinger.net > GPG fingerprint = C518 BC70 E67F 143F BE91 3365 79E2 9C60 B006 3FE7 > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-fs" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message