Score:1

WARNING: Filesystem system has error. couldn't fIx parent of node 47322B43 Couldn't find parent directory entry

cr flag

WARNING: Filesystem system has error. couldn't fIx parent of node 47322B43 Couldn't find parent directory entry.

I have Ubuntu 22.04.2 LTS (Jammy Jellyfish) OS installed every time i boot getting following error. i have tried fsck -f /dev/sda2 still getting these error. please suggest how to fix my system enter image description here

Raffa avatar
jp flag
Save your time with this one ... `fsck` and other tools won't solve it ... It's an orphan NULL directory inode ... If I get free time in front of a PC today I will explain more about it and probable fix in an answer or otherwise tomorrow ... But hopefully someone else will be free and help you fix it sooner than that ... Basically that inode needs fixing(*manually*) before any filesystem checking tool can handle it ... Oh, and it should be harmless ... No rush :-)
Hithesh kumar avatar
cr flag
Thank you @Raffa , so this issue is fixable without replacing any hard drive ? just trying to understand what is the root cause of this issue ?
Hithesh kumar avatar
cr flag
After diagnose from IT person got to know my hard disk is having bad sectors means its dead, however i couldn't do any thing about it. so i tried to erase all data and install ubuntu fresh, this worked for me.
Score:4
jp flag

Let's first understand inodes in layman's terms

By doing ... Our filesystem of choice for this demonstration will be EXT2 because it does not have a journaling mechanism and thus will be easy to corrupt for the purposes of demonstrating some inode related problems.

Let's create a "disk" image file:

$ truncate -s 10M myfilesystem

And format it

$ mkfs.ext2 myfilesystem
mke2fs 1.46.5 (30-Dec-2021)
Discarding device blocks: done
Creating filesystem with 2560 4k blocks and 2560 inodes

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

Notice the number of inodes ... and 2560 inodes ... This is the permanant maximum number for this filesystem on this disk partition ... You can create as many files(all kinds including directories) as that number(minus the filesystem's special inodes) but no more than that number on this filesystem.

Let's create a mount point and mount that filesystem:

$ mkdir mymount
$
$ mount myfilesystem mymount/
$
$ ls -la mymount/
total 24
drwxr-xr-x 3 root   root    4096 May  8 14:24 .
drwxr-xr-x 3 ubuntu ubuntu  4096 May  8 14:29 ..
drwx------ 2 root   root   16384 May  8 14:24 lost+found
$
$ df -ih mymount/
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/loop1       2.5K    11  2.5K    1% /home/ubuntu/test/mymount

Notice the number of used inodes 11 ... These are called special inodes and reserved/used by default for the filesystem special predefined purposes... Let's use some more of them:

$ touch mymount/file{1..2}
$
$ ls -lai mymount/
total 24
   2 drwxr-xr-x 3 root   root    4096 May  8 14:33 .
2552 drwxr-xr-x 3 ubuntu ubuntu  4096 May  8 14:29 ..
  12 -rw-r--r-- 1 root   root       0 May  8 14:33 file1
  13 -rw-r--r-- 1 root   root       0 May  8 14:33 file2
  11 drwx------ 2 root   root   16384 May  8 14:24 lost+found
$
$ df -ih mymount/
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/loop1       2.5K    13  2.5K    1% /home/ubuntu/test/mymount

We created two files and used two more inodes and ended up with 11 + 2 = 13.

Let's free one of them:

$ rm mymount/file1
$
$ df -ih mymount/
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/loop1       2.5K    12  2.5K    1% /home/ubuntu/test/mymount

That's normal 13 - 1 = 12 used inodes and the one we just freed will be reused when needed ... inodes are recyclable.

That is under normal conditions ... But, what if we in another shell continuously open and use a file:

$ tail -f mymount/file2
-

Then go back to our original shell to delete that file then immediately ungracefully unmount the filesystem:

$ rm mymount/file2 && umount -l myfilesystem
$
$ ls -lai mymount/
total 8
6425 drwxr-xr-x 2 root   root   4096 May  8 14:29 .
2552 drwxr-xr-x 3 ubuntu ubuntu 4096 May  8 14:29 ..

Then, mount it again:

$ mount myfilesystem mymount/
$
$ ls -lai mymount/
total 24
   2 drwxr-xr-x 3 root   root    4096 May  8 14:44 .
2552 drwxr-xr-x 3 ubuntu ubuntu  4096 May  8 14:29 ..
  11 drwx------ 2 root   root   16384 May  8 14:24 lost+found
$
$ df -ih mymount/
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/loop1       2.5K    12  2.5K    1% /home/ubuntu/test/mymount

Notice how although the file has been actually deleted but it's inode is not freed up ... That is a filesystem corruption "simulation" ... Let's unmount and check:

$ umount myfilesystem
$
$ e2fsck myfilesystem
e2fsck 1.46.5 (30-Dec-2021)
myfilesystem was not cleanly unmounted, check forced.
Pass 1: Checking inodes, blocks, and sizes
Deleted inode 13 has zero dtime.  Fix<y>? yes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Inode bitmap differences:  -13
Fix<y>? yes
Free inodes count wrong for group #0 (2548, counted=2549).
Fix<y>? yes

myfilesystem: ***** FILE SYSTEM WAS MODIFIED *****
myfilesystem: 11/2560 files (0.0% non-contiguous), 170/2560 blocks

Let's close the other shell and mount again and check:

$ mount myfilesystem mymount/
$
$ df -ih mymount/
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/loop1       2.5K    11  2.5K    1% /home/ubuntu/test/mymount

Now you know the basics of how inodes are used ... And some of what could go wrong with them to trigger a filesystem check and how ... The same can happen while plugging/unplugging a disk or when the system looses power suddenly as files(especially system files) are created/deleted/updated constantly by system processes ... It is a bit less in case of directories as it's not normally possible to hold a directory open by a process as they don't have a handle like ordinary files, but corruption can happen with directory inodes if the above happened while their meta data is being updated/modified and also, although rare, it can happen when the filesystem looses access to certain blocks due to a failing/deteriorating disk drive.

However, most issues with inodes can be easily automatically fixed by filesystem checking utilities.

Back to your question

There are times, however, when those utilities loose path and don't know how to fix an issue with inodes especially with directories that don't have valid readable meta data as among the methods those tools use to fix corruption with inodes is actually meta data that identify directories contents, parents ... etc.

The screenshot you included makes it a bit hard for me to read and copy text from ... However, what you appear to have is an inode 4732284 (under /usr/src/linux ... /net/ ...) that is labeled as a directory in the filesystem but, lacks the usual metadata describing it's relation to its parents which makes it orphaned and it doesn't occupy the usual one block space e.g. 4k but rather occupies 0 space and hence the NULL ... While on most filesystems files are allowed to be null/0 in size, directories are not, please see this post and this post for more details.

This type of problem, if it doesn't increase dramatically which might indicate a failing disk drive/bad and deteriorated blocks, is not a big issue and should be harmless ... To get rid of it the easy way, You just need to use it ... i.e. create a file in that directory then remove it to update its meta information so that it goes back to using a full filesystem block size and look a bit normal ... That directory should be easy to spot as it will show 0 size in the output of e.g. ls -la and after you use it, it should show the usual block size e.g. 4klike other directories on the same filesystem ... If that is not enough to bring it back to normal, then shake it more with e.g. setting its ownership e.g. chown root:root or changing its permissions e.g. chmod 755 until ls -la shows some size other than 0 for that directory.

Then unmount the containing filesystem and run the filesystem checking utility again and it should fix it this time.

That should work but, if it didn't work, then you have two alternatives ... Either using a filesystem debugger like debugfs to fix/delete that inode's entry manually or alternatively backing up your data and reformatting that disk partition.

Technical references:
Hithesh kumar avatar
cr flag
hats off !! well explained. @Raffa
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.