From owner-freebsd-questions@freebsd.org Mon Aug 24 22:27:40 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 993223CF78D for ; Mon, 24 Aug 2020 22:27:40 +0000 (UTC) (envelope-from kh@panix.com) Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bb6FS0GkQz4MQ9 for ; Mon, 24 Aug 2020 22:27:39 +0000 (UTC) (envelope-from kh@panix.com) Received: from rain.home (pool-173-48-64-3.bstnma.fios.verizon.net [173.48.64.3]) by mailbackend.panix.com (Postfix) with ESMTPSA id 4Bb6FR0b7fztHC for ; Mon, 24 Aug 2020 18:27:39 -0400 (EDT) Subject: Re: Suggestion regarding fsck output enhancement To: freebsd-questions@freebsd.org References: <20200824104017.4c241ec0.freebsd@edvax.de> From: Kurt Hackenberg Message-ID: <12f154c3-078f-401d-6a48-dc2f700a4d1d@panix.com> Date: Mon, 24 Aug 2020 18:27:36 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200824104017.4c241ec0.freebsd@edvax.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Bb6FS0GkQz4MQ9 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of kh@panix.com designates 166.84.1.89 as permitted sender) smtp.mailfrom=kh@panix.com X-Spamd-Result: default: False [-0.95 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[166.84.1.89:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:166.84.0.0/16]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; NEURAL_SPAM_SHORT(0.19)[0.194]; RCVD_IN_DNSWL_MED(-0.20)[166.84.1.89:from]; DMARC_NA(0.00)[panix.com]; NEURAL_HAM_MEDIUM(-0.65)[-0.647]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:2033, ipnet:166.84.0.0/16, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[freebsd-questions]; RECEIVED_SPAMHAUS_PBL(0.00)[173.48.64.3:received] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2020 22:27:40 -0000 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?