0

I have a SD card that is giving me some trouble. I followed some instructions from here https://forums.linuxmint.com/viewtopic.php?t=368230 and used the command

sudo dd if=/dev/zero of=/dev/sdb bs=1M count=1

(I know this is dangerous. i've done it because the card was really cheap, and I suspect it is bogus). it ran without errors, but now my system doesnt recognize the card anymore. Gparted and lsblk can't find it (they don't return any sdb). running 'sudo dmesg -w' gives me this:

[ 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

So i'd like to know if it still can be saved. to be honest, being unable to fix it bugs me more than losing the card itself. i'm sure some of you share this feeling sometimes :)

I'm in Debian Testing/Bookworm

thanks in advance!

EDIT: as suggested by zomega, I tried modprobe usbmon + wireshark. i just don't understand much of it

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
4
  • A SD card that claims to have a capacity of 500 GiB (near the top end of currently-available SDXC cards) and was "really cheap"? It's bogus, no question about it.
    – telcoM
    Jan 22, 2023 at 19:44
  • yup, but I want to know its real capacity
    – Diego
    Jan 24, 2023 at 10:50
  • @Diego can you define "real", please, in the context of SD cards? These are heavily error-coded storage devices, making extensive use of bad block tables and shadow memory for wear leveling. "Real" capacity makes an assumption on the appropriate level (and hence, rate) of error coding, a threshold for marking a block "bad" and the appropriate amount of backup blocks. So, a NAND flash that has, say, 8 billion cells, each carrying 2 or 3 bits, can have anywhere between 3 and 0 GB of "real" capacity. Jan 24, 2023 at 13:38
  • The fact that even high quality SD cards are affordable is exactly because modern flash controllers can trade of capacity for reliability in a wide range, and deal with partially defective memory as if it wasn't there. So, this "real" capacity you speak about, it simply doesn't exist. Jan 24, 2023 at 13:39

2 Answers 2

1

When a card suddenly changes to 0 capacity, that's not under the control of your PC: that's the controller within the SD card stopping to work.

Since you have no way of debugging the software running on that controller, nor any way to look inside its hardware:

Your card is e-waste. That was essentially clear when you said "I suspect it is bogus", as a data storage medium which you can't trust is worse than none.

0

First reboot your PC and perhaps get a another working SD card (SD card 2) and SD card reader (reader 2). Put SD card 2 into both readers to be sure the readers are fine. Put SD card 1 (the broken one) into reader 2 to see if it is working there.

Now to debug what exactly is wrong with SD card 1 you can use Wireshark. SD card readers are normally connected via USB. I have an USB flash drive with additional micro SD card reader. But also card readers of laptops and desktop PCs are normally connected via USB.

Run this as root user:

modprobe usbmon

Then start Wireshark. You will see usbmon* interfaces to capture. Honestly I do not know how to identify the right one easyly. But you can open them. When the SD card is not plugged there should be no traffic and when you plug it in you must see traffic. Maybe someone here knows how to identify the right interface easier.

You can now see what exactly is happening and why the SD card is reporting size 0.

Also note that it is possible to use various protocols when talking to a SD card. You could try out different protocols. See this video.

1
  • I did it, i just don't what I'm looking for exactly... but I edited the original post
    – Diego
    Jan 24, 2023 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .