我的 SD 卡给我带来了一些麻烦。我按照这里的一些说明https://forums.linuxmint.com/viewtopic.php?t=368230并使用了命令
sudo dd if=/dev/zero of=/dev/sdb bs=1M count=1
(我知道这很危险。我这样做是因为这张卡真的很便宜,而且我怀疑它是假的)。它运行没有错误,但现在我的系统不再识别该卡。Gparted 和 lsblk 找不到它(它们不返回任何 sdb)。运行 'sudo dmesg -w' 给我这个:
[ 6333.845914] sd 2:0:0:0: [sdb] 1048780800 512-byte logical blocks: (537 GB/500 GiB)
[ 6333.846242] sd 2:0:0:0: [sdb] Write Protect is off
[ 6333.846249] sd 2:0:0:0: [sdb] Mode Sense: 2f 00 00 00
[ 6333.846572] sd 2:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[ 6333.851162] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[ 6334.376852] exFAT-fs (sdb): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 6334.916786] exFAT-fs (sdb): error, invalid access to FAT (entry 0x00000007) bogus content (0x3eac7bca)
[ 6334.916798] exFAT-fs (sdb): Filesystem has been set read-only
[ 6334.916802] exFAT-fs (sdb): failed to initialize root inode
[ 6342.202999] exFAT-fs (sdb): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 6342.767908] exFAT-fs (sdb): error, invalid access to FAT (entry 0x00000007) bogus content (0x3eac7bca)
[ 6342.767925] exFAT-fs (sdb): Filesystem has been set read-only
[ 6342.767930] exFAT-fs (sdb): failed to initialize root inode
[ 6365.545658] sdb: detected capacity change from 1048780800 to 0
所以我想知道它是否仍然可以保存。老实说,无法修复它比丢失卡本身更让我烦恼。我相信你们中的一些人有时也会有这种感觉 :)
我在 Debian 测试/Bookworm
提前致谢!
编辑:按照 zomega 的建议,我尝试了 modprobe usbmon + wireshark。我只是不太明白
Frame 22971: 71 bytes on wire (568 bits), 71 bytes captured (568 bits) on interface usbmon0, id 0
Section number: 1
Interface id: 0 (usbmon0)
Interface name: usbmon0
Encapsulation type: USB packets with Linux header and padding (115)
Arrival Time: Jan 24, 2023 08:28:54.570098000 -03
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1674559734.570098000 seconds
[Time delta from previous captured frame: 0.099905000 seconds]
[Time delta from previous displayed frame: 0.099905000 seconds]
[Time since reference or first frame: 233.430201000 seconds]
Frame Number: 22971
Frame Length: 71 bytes (568 bits)
Capture Length: 71 bytes (568 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: usb]
USB URB
[Source: 1.2.1]
[Destination: host]
URB id: 0xffff9197d7386480
URB type: URB_COMPLETE ('C')
URB transfer type: URB_INTERRUPT (0x01)
Endpoint: 0x81, Direction: IN
1... .... = Direction: IN (1)
.... 0001 = Endpoint number: 1
Device: 2
URB bus id: 1
Device setup request: not relevant ('-')
Data: present ('\0')
URB sec: 1674559734
URB usec: 570098
URB status: Success (0)
URB length [bytes]: 7
Data length [bytes]: 7
[Request in: 22970]
[Time from request: 0.099905000 seconds]
[bInterfaceClass: Unknown (0xffff)]
Unused Setup Header
Interval: 1
Start frame: 0
Copy of Transfer Flags: 0x00000204, No transfer DMA map, Dir IN
.... .... .... .... .... .... .... ...0 = Short not OK: False
.... .... .... .... .... .... .... ..0. = ISO ASAP: False
.... .... .... .... .... .... .... .1.. = No transfer DMA map: True
.... .... .... .... .... .... ..0. .... = No FSBR: False
.... .... .... .... .... .... .0.. .... = Zero Packet: False
.... .... .... .... .... .... 0... .... = No Interrupt: False
.... .... .... .... .... ...0 .... .... = Free Buffer: False
.... .... .... .... .... ..1. .... .... = Dir IN: True
.... .... .... ...0 .... .... .... .... = DMA Map Single: False
.... .... .... ..0. .... .... .... .... = DMA Map Page: False
.... .... .... .0.. .... .... .... .... = DMA Map SG: False
.... .... .... 0... .... .... .... .... = Map Local: False
.... .... ...0 .... .... .... .... .... = Setup Map Single: False
.... .... ..0. .... .... .... .... .... = Setup Map Local: False
.... .... .0.. .... .... .... .... .... = DMA S-G Combined: False
.... .... 0... .... .... .... .... .... = Aligned Temp Buffer: False
Number of ISO descriptors: 0
Leftover Capture Data: 0200ff0f000000
当一张卡突然变为 0 容量时,那不是在你的 PC 的控制之下:那是 SD 卡内的控制器停止工作。
由于您无法调试在该控制器上运行的软件,也无法查看其硬件内部:
你的卡是电子垃圾。当您说“我怀疑它是假的”时,这一点基本上很清楚,因为您不能信任的数据存储介质总比没有更糟糕。
首先重新启动您的 PC,或许再获得一张可以正常工作的 SD 卡(SD 卡 2)和 SD 读卡器(读卡器 2)。将 SD 卡 2 放入两个读卡器以确保读卡器正常。将 SD 卡 1(损坏的)放入读卡器 2 中,看它是否在那里工作。
现在要调试 SD 卡 1 到底出了什么问题,您可以使用 Wireshark。SD 卡读卡器通常通过 USB 连接。我有一个带有附加微型 SD 读卡器的 USB 闪存驱动器。但笔记本电脑和台式电脑的读卡器通常也是通过 USB 连接的。
以 root 用户身份运行:
然后启动 Wireshark。您将看到要捕获的 usbmon* 接口。老实说,我不知道如何轻松识别正确的。但是你可以打开它们。当 SD 卡未插入时,应该没有流量,当您插入时,您必须看到流量。也许这里有人知道如何更容易地识别正确的接口。
您现在可以看到到底发生了什么以及 SD 卡报告大小为 0 的原因。
另请注意,与 SD 卡通信时可以使用各种协议。您可以尝试不同的协议。看这个视频。