menu Chancel's Blog
rss_feed lightbulb_outline

Linux使用fsck修复磁盘

类型:Linux
创建时间:2021-08-12 10:03:27
更新时间:2021-08-12 10:03:27
类型:Linux
更新时间:2021-08-12 10:03:27

使用Proxmox挂载虚拟机的E3服务器因为SSD硬盘掉盘导致多次启动崩溃,等到修复好硬盘问题发现Ubuntu虚拟机无法正常启动,开机显示如下错误

从报错内容看不出所以然来,但既然是因为掉盘导致的系统错误,那先尝试下修复系统盘,使用CD-LIVE进入系统

进入CD-LIVE系统后,查找相关系统盘并修复

❯ sudo fdisk -l                                                               ~
[sudo] password for chancel: 
Disk /dev/nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: KIOXIA-EXCERIA SSD                      
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D01367E9-8A85-5249-815A-240299266312

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      4096    618495    614400   300M EFI System
/dev/nvme0n1p2    618496 841037811 840419316 400.7G Linux filesystem
/dev/nvme0n1p3 841037812 976768064 135730253  64.7G Linux swap

Disk /dev/loop0: 99.38 MiB, 104202240 bytes, 203520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 99.38 MiB, 104210432 bytes, 203536 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

...

❯ sudo fsck /dev/nvme0n1p2

fsck是一个Linux修复磁盘工具,在修复过程会自行排查相关磁盘异常并提示是否修复,修复过程如图

修复之后可以顺利启动系统

[[replyMessage== null?"发表评论":"@" + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageList.data.items.length]])

[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[messageItem.m_environ.browser]] [[messageItem.m_environ.os]] [[messageItem.m_environ.device]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[subMessage.m_environ.browser]] [[subMessage.m_environ.os]] [[subMessage.m_environ.device]]