Suggestion regarding fsck output enhancement
kh at panix.com
Sat Aug 29 18:59:18 UTC 2020
On 2020-08-28 22:18, Kevin P. Neal wrote:
>> 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.
> Well, it would require building an in-memory version of the filesystem's
> metadata. Except that fsck already needs that (minus the filenames) in order
> to do its job, right? How else would it know that, for example, an inode
> is unreferenced.
> Poly, I think you should open a bug report/feature request on the official
> FreeBSD bugtracker. If you haven't already.
You might want to estimate the amount of memory needed to hold all the
filenames in a large filesystem.
What fsck does now probably needs just an array of reference counts,
indexed by inode number.
Each inode in use is pointed to by at least one directory entry, a
filename that can be up to 255 characters long (though usually they're
much shorter). In practice, extra hard links aren't used much for
regular files, but each directory has two links plus another for each of
its subdirectories. (The extra link names are short, though: "." and "..".)
You could estimate, say, 1.1 filenames per inode, times maybe 32
characters each, times the default number of inodes allocated in a 1 TB
filesystem, whatever that is.
More information about the freebsd-questions