Date: Mon, 24 Aug 2020 18:27:36 -0400 From: Kurt Hackenberg <kh@panix.com> To: freebsd-questions@freebsd.org Subject: Re: Suggestion regarding fsck output enhancement Message-ID: <12f154c3-078f-401d-6a48-dc2f700a4d1d@panix.com> In-Reply-To: <20200824104017.4c241ec0.freebsd@edvax.de> References: <20200824104017.4c241ec0.freebsd@edvax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
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 not easy. 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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?12f154c3-078f-401d-6a48-dc2f700a4d1d>