Is there way to get filename for specific LBA?

Marcin Wisnicki mwisnicki+freebsd at gmail.com
Fri Sep 2 20:46:35 UTC 2011


On Wed, 31 Aug 2011 20:50:18 -0700, Carl Johnson wrote:

> 
> It looks like the best bet would be fsdb, assuming that it is a UFS file
> system.  That does have a 'findblk' command to find a file containing a
> block, but you would need to calculate the block offset in the
> filesystem first.  It doesn't look like it would be easy, as was said
> earlier.

I have a ruby script for this that wraps various commands.

You pipe an error log to it and it finds files:

  blocks2file.rb < /var/log/messages

Currently, it looks only for geom errors (with byte offsets) but that can 
be easily adjusted.
It helped me find the source of my problems in the past but I haven't 
worked on it since.

Here it is: https://github.com/mwisnicki/freebsd-block2file



More information about the freebsd-questions mailing list