0

I am stuck in the problem. The fsck commands on the desktop computer showed the error of the file system for the mounted root directory. So, I created the bootable USB stick of Ubuntu, and made it boot. And then, I tried to fix the file system error with executing the fsck on the USB stick since the fsck cannot fix a mounted directory. However, the fsck on the USB stick showed no error. How should I fix this file system error?

(The fsck on the desktop computer)

$ sudo fsck -nf /dev/nvme0n1p2
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
Warning!  /dev/nvme0n1p2 is mounted.
Warning: skipping journal recovery because doing a read-only filesystem check.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found.  Fix? no

Inode 6816186 was part of the orphaned inode list. IGNORED. Inode 6816770 was part of the orphaned inode list. IGNORED. Inode 6883264 was part of the orphaned inode list. IGNORED. Inode 6883789 was part of the orphaned inode list. IGNORED. Inode 6887919 was part of the orphaned inode list. IGNORED. Inode 6887920 was part of the orphaned inode list. IGNORED. Inode 6887925 was part of the orphaned inode list. IGNORED. Inode 6887929 was part of the orphaned inode list. IGNORED. Deleted inode 6887947 has zero dtime. Fix? no

Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information Block bitmap differences: -(9588738--9588745) -(9588760--9588764) -(9597955--9597964) -(9998851--9998855) -(27306830--27306834) -(27307548--27307557) -34598400 Fix? no

Free blocks count wrong (43144465, counted=43144229). Fix? no

Inode bitmap differences: -6816186 -6816770 -6883264 -6883789 -(6887919--6887920) -6887925 -6887929 -6887947 Fix? no

Free inodes count wrong (14401240, counted=14401183). Fix? no

/dev/nvme0n1p2: ********** WARNING: Filesystem still has errors **********

/dev/nvme0n1p2: 557352/14958592 files (0.5% non-contiguous), 16670447/59814912 blocks

(The fsck on the bootable USB stick)

ubuntu@ubuntu:~$ sudo fsck -fy /dev/nvme0n1p2
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/nvme0n1p2: 557879/14958592 files (0.6% non-contiguous), 16680714/59814912 blocks

ubuntu@ubuntu:~$ sudo fsck -fn /dev/nvme0n1p2 fsck from util-linux 2.31.1 e2fsck 1.44.1 (24-Mar-2018) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/nvme0n1p2: 557879/14958592 files (0.6% non-contiguous), 16680714/59814912 blocks ubuntu@ubuntu:~$

FYI:

Ubuntu 18.04 LTS for both the desktop and the bootable USB stick

The terminal window fails to open while the xterm can open. I consider that the file system error may affect this opening fail.

Haru
  • 3
  • The anadium's advise could be helpful for me. About the terminal window problem, the cause seems to be upgrading Python 2.7 to Python 3.5.

    Anyway, thank you for all your advises.

    – Haru Jul 13 '20 at 09:20

2 Answers2

1

It's good to have some background information on what inodes are and what an orphaned inode is, when you come across a message like this.

At https://unix.stackexchange.com/questions/290116/what-is-an-orphaned-inode I read the following explanation by Stephen Kitt:

An orphaned inode is an inode which isn't attached to a directory entry in the filesystem, which means it can't be reached.

Orphaned inodes can appear for a number of reasons:

temporary files which are deleted but kept open (a common practice) occupy inodes on the filesystem; if the system reboots without shutting down properly, these inodes remain and are orphaned filesystem corruption may corrupt a directory without affecting the inodes of the files the directory contains; these inodes are then orphaned fsck creates new directory entries for orphaned inodes in lost+found.

To understand the inode system, have a look at https://linuxhandbook.com/inode-linux/, by Eric Simard. It's a bit technical, but it makes for an interesting read. In short:

An inode is a data structure … … that stores all the information about a file except its name and its actual data.

Thanks for your question; it made me understand Linux a bit better!

Ome Cor
  • 11
0

Apparently, your first check is a "read only" check of an active, mounted file system. That will not be reliable. The check from your USB live session, while the partition is not mounted, is the correct one.

So don't worry. The system drives are automatically subject to a quick check each start up, and temporarily a more rigid check, which goes fast with the ext4 file system. You still can force a full check at startup by creating an empty file forcefsck in the root directory of the volume:

sudo touch /forcefsck

will create the file in your root file system and signal the system to fully check it when the system is restarted. After the check, the empty file is automatically removed.

vanadium
  • 88,010
  • After that, I found that your analysis was correct. In fact, I conducted clean install to solve other troubles. And then I ran the fsck, and it said the same error as the above question. Thank you for your advise. – Haru Jul 16 '20 at 09:17