[Bug 255979] fsck bad inode number 2 (256) to nextinode

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 18 May 2021 18:19:48 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255979

            Bug ID: 255979
           Summary: fsck bad inode number 2 (256) to nextinode
           Product: Base System
           Version: 13.0-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: forums@px.in.ua

Hi.

Yesterday I've noticed that I have a following message in /var/log/messages

May 16 13:24:13 bsd-route fsck[1606]: /dev/ufs/pxstore: NO WRITE ACCESS
May 16 13:24:13 bsd-route fsck[1606]: /dev/ufs/pxstore: UNEXPECTED
INCONSISTENCY; RUN fsck MANUALLY.
May 16 13:24:13 bsd-route fsck[1606]: /dev/ufs/pxstore: CANNOT SET FS_NEEDSFSCK
FLAG

Underlying hdd holds a single Jail with torrent client, so I've shut down the
client, don't remember if I've also shut down the jail itself, then I've
unmounted drive with -f switch, and run fsck on it. fsck found a lot of errors,
like

129516299 DUP I=64686337
UNEXPECTED SOFT UPDATE INCONSISTENCY

2661355758115450807 BAD I=23756482
UNEXPECTED SOFT UPDATE INCONSISTENCY

-8999617908267060188 BAD I=23756482
UNEXPECTED SOFT UPDATE INCONSISTENCY

CYLINDER GROUP 3944: INTEGRITY CHECK FAILED
UNEXPECTED SOFT UPDATE INCONSISTENCY

INCORRECT BLOCK COUNT I=486994392 (56264 should be 49112)

INODE 486994392: FILE SIZE 28746675 BEYOND END OF ALLOCATED FILE, SIZE SHOULD
BE 25133056

and some others (you can see 512KB of the log here -
https://pastebin.com/Xcm1iKCc), but in the end to my surprise fsck exited with
the following error:

INTERNAL ERROR: dups with softupdates
UNEXPECTED SOFT UPDATE INCONSISTENCY
** Phase 1b - Rescan For More DUPS
fsck_ufs: bad inode number 2 to nextinode

After some search I was lucky to find the following commit
https://cgit.freebsd.org/src/commit/?id=bc444e2ec6e6cc9d96d35ab7ce3c02c0da952fad
Fix fsck_ffs Pass 1b error exit "bad inode number 2 to nextinode".

As I'm running 13-RELEASE, I went to
https://download.freebsd.org/ftp/snapshots/amd64/13.0-STABLE/, downloaded
base.txz file, took fsck* files from it, and put them instead of existing in
/sbin, but the only change I've got is the number change from 2 to 256

INTERNAL ERROR: dups with softupdates
UNEXPECTED SOFT UPDATE INCONSISTENCY
** Phase 1b - Rescan For More DUPS
fsck_ufs: bad inode number 256 to nextinode

On fsck re-run I'm getting the same list of the errors, and the check ends with
the same result.

I've mounted the disk in r/o mode, and can see the folders structure just fine,
random files check showed that they are fine, text/images/video renders without
errors. SMART for disk is fine, general status is PASSED, and there are no
reallocation events

Am I assuming correctly that fix above is incomplete, and fsck should recover
file system my case too? Any other way to fix it without moving all the data
elsewhere, and recreating file system?

-- 
You are receiving this mail because:
You are the assignee for the bug.