Can't create a partition table on micro SD card

1

2

I'm trying to reformat a micro SD card that was previously in a raspberry pi (and had stopped working). However, when I plug it into my main computer (arch) and try to partition it, I can't because gparted says it has no partition table. When I try to fix that by adding a partition table (GPT), I get the errors below. How can I fix my uSD card?

I've also included the output of dmesg when I plug it in if that helps. I don't have access to any other OS, so I can't just try something on Windows.

output of gparted when I try to put a partition table on the card:

/dev/mmcblk0: unrecognised disk label
Input/output error during write on /dev/mmcblk0
Error fsyncing/closing /dev/mmcblk0: Input/output error

dmesg output when the card is plugged in:

[99702.919024] sdhci: Timeout waiting for Buffer Read Ready interrupt during tuning procedure, falling back to fixed sampling clock
[99702.919048] mmc0: new ultra high speed SDR104 SDHC card at address 59b4
[99702.920575] mmcblk0: mmc0:59b4 00000 7.35 GiB 
[99702.930961] mmc0: Controller never released inhibit bit(s).
[99712.952421] mmc0: Timeout waiting for hardware interrupt.
[99712.952498] mmcblk0: error -110 sending status command, retrying
[99712.954084] mmcblk0: unknown error -5 sending read/write command, card status 0x900
[99714.412427] sdhci: Timeout waiting for Buffer Read Ready interrupt during tuning procedure, falling back to fixed sampling clock
[99714.412447] mmc0: tried to reset card
[99714.422507] mmc0: Controller never released inhibit bit(s).
[99724.445769] mmc0: Timeout waiting for hardware interrupt.
[99724.445834] mmcblk0: error -110 sending status command, retrying
[99724.448129] mmcblk0: unknown error -5 sending read/write command, card status 0x900
[99724.448136] blk_update_request: I/O error, dev mmcblk0, sector 0
[99724.448140] Buffer I/O error on dev mmcblk0, logical block 0, async page read
[99724.448668] ldm_validate_partition_table(): Disk read failed.
[99724.448673]  mmcblk0: unable to read partition table

ZuluDeltaNiner

Posted 2016-05-23T03:36:43.313

Reputation: 363

If you see a cow and the head is dismantled from the body, her legs are in the trees and her guts are spilled all over the place, would you try first aid or would you think she's only sleeping? – Frank Sixteen – 2016-05-23T04:14:59.010

So I should get another sd card? @FrankSixteen – ZuluDeltaNiner – 2016-05-23T04:39:23.023

Well, I wouldn't say it follows by necessity, but if you want to, why not? – Frank Sixteen – 2016-05-23T05:04:31.607

Answers

1

There is a known bug in the Linux Kernel 4.4-rc4 and later (It still persists today). You can read about this bug and a possible workaround on kernel.org.

It essentially breaks down to disable optional feature querying, which effectively hangs the card reader hardware:


The temporary workaround

  1. Unload the sdhc modules with

rmmod sdhci sdhci_pci sdhci_acpi

  1. Reload the modules with options to disable the optional features with

modprobe sdhci debug_quirks2="0x10000"

  1. Load the sdhci_pci module again with modprobe sdhci_pci

Try again with your SD card. It may take some seconds to initialize though (because the queries still time out, but we ignore that now).

If this works for you, continue with the permanent workaround


The permanent workaround

Please note, that it still is a workaround and may fail in the future. You should disable the workaround on future kernel versions to see if the bug has been fixed.

  1. Create a modprobe config file in /etc/modprobe.d (or whereever your distribution stores the config files) and write the module options down there. The name does not matter, as long as it ends with .conf.

echo 'options sdhci debug_quirks2="0x10000"' > /etc/modprobe.d/dell_sdhci.conf

The options will be loaded when booting up in the future. If it does not, you may try to hack the temporary fix into a startup script, as a very dirty, but possible, solution.

SiLeX

Posted 2016-05-23T03:36:43.313

Reputation: 73

-1

This SD card is defective or damaged or the electrical pins are bad. Try again after cleaning them. If it still fails, then it is time for a new SD card.

Skaperen

Posted 2016-05-23T03:36:43.313

Reputation: 1

The controller chip is clearly fried. I can't think of a more hostile environment for a high speed chip, fragile to electrostatic discharge than when an amateur is playing with his open Raspberry, and of course in the absence of any anti-electrostatic device. – Frank Sixteen – 2016-05-23T05:19:15.303

I noticed after that this card was class 8, which is less than the recommended class 10. I think that was my problem, combined with the above. – ZuluDeltaNiner – 2016-05-25T04:24:33.493