我的 Raspberry Pi 在启动时出现 kernelPanic,原因似乎是文件系统损坏。我尝试运行 fsck 进行确认,但遇到了问题。
我已将 micro SD 卡插入适配器并插入计算机(已检查以确保“锁定”开关已打开)。我在 VMware Workstation 15.5.6 中运行 Ubuntu Server 20.04,dmesg 输出如下:
[433695.441308] usb 1-1: new high-speed USB device number 3 using ehci-pci
[433695.819170] usb 1-1: New USB device found, idVendor=058f, idProduct=6335, bcdDevice= 1.02
[433695.819239] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[433695.819240] usb 1-1: Product: Mass Storage Device
[433695.819249] usb 1-1: Manufacturer: Generic
[433695.819253] usb 1-1: SerialNumber: 058F011111B1
[433695.842661] usb-storage 1-1:1.0: USB Mass Storage device detected
[433695.876310] scsi host33: usb-storage 1-1:1.0
[433696.972969] scsi 33:0:0:0: Direct-Access SD/MMC Card Reader 1.00 PQ: 0 ANSI: 0
[433696.974349] sd 33:0:0:0: Attached scsi generic sg4 type 0
[433697.284484] sd 33:0:0:0: [sdc] 62552064 512-byte logical blocks: (32.0 GB/29.8 GiB)
[433697.295757] sd 33:0:0:0: [sdc] Write Protect is on
[433697.295759] sd 33:0:0:0: [sdc] Mode Sense: 03 00 80 00
[433697.305852] sd 33:0:0:0: [sdc] No Caching mode page found
[433697.306476] sd 33:0:0:0: [sdc] Assuming drive cache: write through
[433697.376621] sdc: sdc1 sdc2
[433697.500241] sd 33:0:0:0: [sdc] Attached SCSI removable disk
我仔细检查以确保 /dev/sdc1 和 /dev/sdc2 都已通过 fdisk -l 卸载,但是当我尝试运行 fsck 时出现以下错误:
~$ sudo fsck -f -y /dev/sdc1
fsck from util-linux 2.34
fsck.fat 4.1 (2017-01-24)
open: Read-only file system
~$ sudo fsck -f -y /dev/sdc2
fsck from util-linux 2.34
e2fsck 1.45.5 (07-Jan-2020)
fsck.ext4: Read-only file system while trying to open /dev/sdc2
Disk write-protected; use the -n option to do a read-only
check of the device.
任何帮助将不胜感激。
答案1
我怀疑 VMWare Workstation 没有授予您对 SD 卡的写入权限。如果您确信这不是问题所在,请继续执行下面的常规非 VMWare 调试步骤。
fdisk -l
非常适合列出分区,但不会告诉您哪些分区正在主动挂载。请尝试mount | grep sdc
并确保有umount
任何匹配。
如果fsck
继续生成只读错误,请dmesg -w
在运行时观察磁盘故障消息。如果 dmesg 中没有出现故障,则锁定开关或 uSD 适配器可能已损坏。如果 dmesg 中出现严重的磁盘故障消息,则是时候使用、或类似工具fsck
提取尽可能多的数据并报废该 SD 卡了。ddrescue
safecopy
myrescue