我陷入了这个问题。桌面计算机上的fsck命令显示挂载根目录的文件系统错误。所以,我创建了 Ubuntu 的可启动 U 盘,并让它启动。然后,我尝试通过在 USB 记忆棒上执行fsck来修复文件系统错误,因为fsck无法修复已安装的目录。但是,U 盘上的fsck没有显示错误。我应该如何修复这个文件系统错误?
(台式电脑上的fsck )
$ 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
(可启动 U 盘上的fsck )
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:~$
供参考:
适用于桌面和可启动 U 盘的 Ubuntu 18.04 LTS
xterm 可以打开时,终端窗口无法打开。我认为文件系统错误可能会影响此打开失败。
当您遇到这样的消息时,最好有一些关于什么是 inode 以及什么是孤立 inode 的背景信息。
在https://unix.stackexchange.com/questions/290116/what-is-an-orphaned-inode我阅读了 Stephen Kitt 的以下解释:
要了解 inode 系统,请查看 Eric Simard 的https://linuxhandbook.com/inode-linux/。这有点技术性,但读起来很有趣。简而言之:
感谢您的提问;它让我对 Linux 有了更好的理解!
显然,您的第一个检查是对活动的已挂载文件系统的“只读”检查。那将是不可靠的。在未挂载分区的情况下,来自 USB 实时会话的检查是正确的。
所以不用担心。系统驱动器在每次启动时都会自动进行快速检查,并且会暂时进行更严格的检查,这与 ext4 文件系统配合得很快。
forcefsck
您仍然可以通过在卷的根目录中创建一个空文件来强制在启动时进行全面检查:将在您的根文件系统中创建该文件,并在系统重新启动时向系统发出信号以对其进行全面检查。检查后,空文件会被自动删除。