Suggestion regarding fsck output enhancement
kh at panix.com
Mon Aug 24 22:27:40 UTC 2020
On 2020-08-24 04:40, Polytropon wrote:
> In both entries, the inode number is mentioned. Wouldn't it be
> nice to display a file or directory name, if possible, to show
> what file could be affected? Basically, it's what you can already
> manually do:
> 1. run fsck in dry mode
> (only list actions, do not take them)
> 2. note inode numbers
> 3. use fsdb to find out what the inodes point to
> 4. take specific action prior to fsck if needed
> My suggestion would be: If this kind of information is available,
> fsck should display it, for example:
> INCORRECT BLOCK COUNT I=24236 (288 should be 268)
> FILENAME ada0p4:/tmp/test.dat
> CORRECT? yes
That would be great. However, from my limited knowledge, I think it's
I know how this works only in old, traditional Unix. As far as I know
it's the same for FreeBSD and its filesystem -- I think it has to stay
the same to preserve semantics -- but I don't know specifically.
I think a directory entry contains only a filename and an inode number.
All other information about the file is in the inode. (Well, apparently
the file type has been copied or moved from the inode to the directory
entry, probably for speed, but that doesn't matter here.)
The trouble is, an inode does not point back to any of the directory
entries that point to it. Far as I know, the only way to find names
associated with an inode is to search the whole filesystem, looking for
directory entries that contain that inode number. That could take a while.
I had never heard of fsdb; I just read the man page. I don't see any
command to trace back from an inode to filenames. Did I miss something?
More information about the freebsd-questions