fsck 修复文件系统_系统 | Linux 系统修复,无需重装

99fb83cfd076cd546cb4565818f6e5dc.png
故事的开始:
前几天,我的Xubuntu无法重起,开机进入 emergency mode

09da74f6af3ba60bec521b3e3fde49eb.png
emergency mode
You are in emergency mode. After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, "systemctl default" or "exit" to boot into default mode.

system logs 显示:

A TPM error (6) occurred attempting to read a pcr value.
......
1-1-port3: unable to enumerate USB device
......

3835a4d4c34f4b381b4cad30d0129306.png
error: read a pcr value

4ee02939fefa081a61c7998cfe2700bf.png


就试着修复系统,在网上搜到一个办法,但是没有成功,也记在这里:

开机按 ThinkVantag键,进入 BIOSsecurity chip里面,选择 activatedisable

我是这样修复的:

制作一个 USB LiveCD启动盘,用启动盘中的 Ubuntu系统启动,然后依次操作:

  • 在外部存储器备份自己的重要数据,以防这个办法失败后,重要数据丢失。
  • 依次输入以下命令:
sudo rm /var/lib/apt/lists/lock
sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/dpkg/lock-frontend
sudo dpkg --configure -a
sudo apt clean
sudo apt-get update --fix-missing
sudo apt install -f
sudo dpkg --configure -a
sudo apt-get upgrade
  • 然后, sudo reboot 重启。
    Eenjoy it!
update1: 2019-2-12
今天,我又把我的Ubuntu弄崩溃了,按上述的办法没有成功。最后我是这样修复的:
  • 用 Ubuntu 的 USB LiveCD 启动机器。
  • 进入终端:
我的 Ubuntu 安装在 /dev/sda2
sudo umount /dev/sda2    #把系统分区卸载
sudo fsck -n /dev/sda2
sudo fsck -n /dev/sda5
sudo fsck -n /dev/sda6    #最后在这个分区发现错误,修复

重要:fsck不可作用于正在挂载的 Linux 分区,更不可作用于 Windows 分区(例如:FAT,NTFS), 还是那句话,修复前请备份重要文件。

重启,成功。

update2: 2019-2-20
今天,我又把我的Ubuntu弄崩溃了,我现在回想,原因应该是这样的:我的系统是64位的,我做的 LiveCD是32位的。我用 fsck修复文件系统后,产生了错误。

现象如下:

xubuntu@xubuntu:~$ sudo fsck -n /dev/sda6
fsck from util-linux 2.31.1
e2fsck 1.44.1 (24-Mar-2018)
/dev/sda6 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found. Fix? no

Inode 139463 was part of the orphaned inode list. IGNORED.
Deleted inode 139499 has zero dtime. Fix? no
......

反正按update1做没有成功。最后我是这样修复的:

sudo e2fsck /dev/sda6
# 在系统引导盘下

然后,一路yes下去,就行了。
例如:

xubuntu@xubuntu:~$ sudo e2fsck /dev/sda6
e2fsck 1.44.1 (24-Mar-2018)
/dev/sda6 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Inodes that were part of a corrupted orphan linked list found. Fix<y>? yes
Inode 139463 was part of the orphaned inode list. FIXED.
Deleted inode 139499 has zero dtime. Fix<y>? yes
Inode 139507 was part of the orphaned inode list. FIXED.
## 略...
Inode 395014 was part of the orphaned inode list. FIXED.
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Block bitmap differences: -(899591--899593) -(1484144--1484152) -1585470 -(1662466--1662468) -(1668096--1669119) -1704896
Fix<y>? yes
Free blocks count wrong for group #27 (26627, counted=26630).
## 略...
Free inodes count wrong (5845477, counted=5845484).
Fix<y>? yes

/dev/sda6: ***** FILE SYSTEM WAS MODIFIED *****
/dev/sda6: 257556/6103040 files (0.8% non-contiguous), 9136639/24401920 blocks
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值