*BSD News Article 4066


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!uunet!usc!sol.ctr.columbia.edu!ira.uka.de!chx400!bernina!neptune!weingart
From: weingart@inf.ethz.ch (Tobias Weingartner)
Subject: BSD ufs (yikes!)
Message-ID: <1992Aug22.182146.4023@neptune.inf.ethz.ch>
Followup-To: poster
Keywords: ufs, inode, blocks, fragments
Sender: news@neptune.inf.ethz.ch (Mr News)
Nntp-Posting-Host: tau.inf.ethz.ch
Reply-To: weingart@inf.ethz.ch
Organization: ETH - Switzerland
Date: Sat, 22 Aug 1992 18:21:46 GMT
Lines: 39

I have a small problem, I have a partition on a disk
that has a bad sector or two. (Under SunOS 4.1.2)

I have not found any utility that allows me to find which
file that bad sector belongs to.  So I set out to write my
own.

The question I have is the following.  In the inode, there
are x direct pointers, and x inderect pointers.  I would like
to know what these point to.  Do they point to blocks (8192) or
do they point to fragments.

Also, what is the standard way to access an inode (not stat!).
I mean, how can you write code that takes some device (raw/block),
an inode number, and then opens the device and reads in the inode.

My code 'seems' to work, I am getting inodes that have to correct
mode (according to ls -li), but for some reason, the direct blocks,
and indirect blocks seem screwed up.

Ie. For a file that is some 4000 bytes long (ascii - c_source), the
indirect block_pointers are zero (as expected), but the directs are
0, 0, some_large_number, 0, 0, 1, 4, ....

Something seems screwy...

Any code (working, or from bio-ram) will be appreciated.

--Toby.

PS:

I have tried pulling down fsdb (wish I had a working version!), and
compiling it.  (Reno version)  There were some things with rot-delay
or something that sun's ufs does not support.  I just commented out
the relevant portions.  Then I tried 2:ino:ls, which should list the
root directory.  All it said, was '/ not found'.  I took a look at the
code, and to my inexperienced eyes, it seems fine...