5

I can

  • read from my micro-sd card when it is in "lock" position

but things get very weird when I try "unlock" it: there is no way I can

  • fsck it, nor
  • mount it, nor
  • read it, nor..
  • format it!

I need to format it, what can I do?

Here is my gparted output:

$ sudo gparted
Created symlink /run/systemd/system/-.mount → /dev/null.
Created symlink /run/systemd/system/boot-efi.mount → /dev/null.
Created symlink /run/systemd/system/home-iago\x2dlito-.docker-devicemapper.mount → /dev/null.
Created symlink /run/systemd/system/home.mount → /dev/null.
Created symlink /run/systemd/system/run-user-1000.mount → /dev/null.
Created symlink /run/systemd/system/run-user-117.mount → /dev/null.
Created symlink /run/systemd/system/tmp.mount → /dev/null.
Created symlink /run/systemd/system/var.mount → /dev/null.

======================
libparted : 3.2                                         # see screenshots
======================                                  #
Input/output error during write on /dev/mmcblk0         # first error
Error fsyncing/closing /dev/mmcblk0: Input/output error # second error
Input/output error during write on /dev/mmcblk0         # start looping
Error fsyncing/closing /dev/mmcblk0: Input/output error #
Input/output error during read on /dev/mmcblk0          #

enter image description here

Clicking Device -> Create partition table

enter image description here

choosing msdos, Apply, wait for a while then

enter image description here

Ignore

enter image description here

And then it starts looping between these two error messages until I finally Cancel.

After cancelling, the status bar displays

enter image description here

for a while, then

enter image description here

.. anyway there is no more mmcblk0 visible in the up-left box.

Any idea what may be wrong?
How can I format my SD card?
Is it just dead?


[EDIT] more info? When inserted in unlocked state:

$ dmesg
...
[ 1282.922022] mmc0: cannot verify signal voltage switch
[ 1283.097715] mmc0: new ultra high speed SDR104 SDHC card at address 0001
[ 1283.104727] mmcblk0: mmc0:0001 SD32G 29.0 GiB 
[ 1283.106469]  mmcblk0: p1 p2
[ 1284.996181] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
[ 1285.018828] EXT4-fs (mmcblk0p2): warning: mounting unchecked fs, running e2fsck is recommended

Oh, okay..

$ sudo e2fsck /dev/mmcblk0
e2fsck 1.43.4 (31-Jan-2017)
e2fsck: Input/output error while trying to open mmcblk0

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

.. suggested commands both yield the same output.


Playing around with f3 on malat advice:

# f3write /dev/mmcblk0p1
f3write: Can't open path /dev/mmcblk0p1: Not a directory

# f3write /dev/mmcblk0p2
f3write: Can't open path /dev/mmcblk0p2: Not a directory

# f3read /dev/mmcblk0p1
f3read: Can't open path /dev/mmcblk0p1: Not a directory

# f3read /dev/mmcblk0p2
f3read: Can't open path /dev/mmcblk0p1: Not a directory

Trying their mounting point instead:

# f3write /media/iago-lito/boot # /dev/mmcblk0p1
f3write: f3write.c:403: get_freespace: Assertion `!statvfs(path, &fs)' failed.
[1]    11908 abort      f3write /media/iago-lito/boot

# f3write /media/iago-lito/0aed834e-8c8f-412d-a276-a265dc676112 # /dev/mmcblk0p2
Free space: 24.50 GB
Creating file 1.h2w ...
f3write: Can't create file 0aed834e-8c8f-412d-a276-a265dc676112/1.h2w: Input/output error

# f3read /media/iago-lito/boot # /dev/mmcblk0p1
                  SECTORS      ok/corrupted/changed/overwritten

  Data OK: 0.00 Byte (0 sectors)
Data LOST: 0.00 Byte (0 sectors)
           Corrupted: 0.00 Byte (0 sectors)
    Slightly changed: 0.00 Byte (0 sectors)
         Overwritten: 0.00 Byte (0 sectors)
Average reading speed: 0.00 Byte/s

# f3read /media/iago-lito/0aed834e-8c8f-412d-a276-a265dc676112 # /dev/mmcblk0p2
                  SECTORS      ok/corrupted/changed/overwritten

  Data OK: 0.00 Byte (0 sectors)
Data LOST: 0.00 Byte (0 sectors)
           Corrupted: 0.00 Byte (0 sectors)
    Slightly changed: 0.00 Byte (0 sectors)
         Overwritten: 0.00 Byte (0 sectors)
Average reading speed: 0.00 Byte/s

.. `smells bad.


Now try playing gdisk with Alex Berry:

First try, both partitions were mounted:

$ sudo gdisk /dev/mmcblk0                                                                          20 ↵
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************


Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.

Command (? for help): x

Expert command (? for help): z
About to wipe out GPT on /dev/mmcblk0. Proceed? (Y/N): Y
Warning! GPT main partition table not overwritten! Error is 0
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.

Expert command (? for help):

Second try after unmounting both partitions:

sudo gdisk /dev/mmcblk0                                                                                                      32 ↵
GPT fdisk (gdisk) version 1.0.1

Warning! Read error 5; strange behavior now likely!
Warning! Read error 5; strange behavior now likely!
Partition table scan:
  MBR: not present
  BSD: not present
  APM: not present
  GPT: not present

Creating new GPT entries.

Command (? for help): x

Expert command (? for help): z
About to wipe out GPT on /dev/mmcblk0. Proceed? (Y/N): Y
Warning! GPT main header not overwritten! Error is 5
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.

.. I am glad error messages (no5) at least are consistent with my deepest thoughts!
Yanking card and rebooting..

Now gparted does not list /dev/mmcblk0 at all after scanning devices:

Input/output error during read on /dev/mmcblk0

hard time for hardware -_-"

iago-lito
  • 2,581
  • 4
  • 20
  • 35
  • 1
    What does `dmesg` show when you insert it while in the unlocked state? – Timothy Martin May 17 '17 at 21:10
  • @TimothyMartin Here you go.. sounds weird, uh? – iago-lito May 18 '17 at 07:12
  • What's the output of `# f3probe --destructive --time-ops /dev/mmcblk` ? See also https://raspberrypi.stackexchange.com/questions/63839/openelec-filesystem-corruption-has-been-detected-after-first-reboot – malat May 18 '17 at 07:22
  • @malat `Device \`/dev/mmcblk0' is not backed by a USB device / Application cannot continue, finishing...`.. whaat? – iago-lito May 19 '17 at 17:24
  • `/dev/mmcblk0`≠ `/dev/mmcblk` please read carefully. – malat May 19 '17 at 19:09
  • @malat I had tried that, but: `f3probe: Can't open device \`/dev/mmcblk': No such file or directory`. So I thought it was a typo :\ – iago-lito May 20 '17 at 08:08
  • @iago-lito well you seems to be using `/dev/mmcblk` all over the place, so I assumed this was a valid `/dev` entry. Check the output of `dmesg` (or `lsblk`) when you insert your card to check if the entry name changed. – malat May 30 '17 at 14:28
  • @malat The output of `dmesg` had already be added to the OP, the name seems to be `mmcblk0` according to this as well. My machine never displayed `mmcblk` but always `mmcblk0`. – iago-lito May 30 '17 at 14:43
  • @iago-lito OK I see my mistake now. `f3probe` seems to require a USB card reader for [now](https://github.com/AltraMayor/f3/issues/14). Do you have one? Or else return to good ol' `f3write /dev/mmcblk0p1` + `f3read /dev/mmcblk0p1`, repeat onto the next partition: `/dev/mmcblk0p2`. [Ref](http://oss.digirati.com.br/f3/) – malat May 30 '17 at 14:48
  • @malat [There](https://unix.stackexchange.com/questions/365716) you go :) – iago-lito May 30 '17 at 15:47
  • Have you formatted with gpt in the past? Trying to format a previously gpt disk as mbr produces screwy results. Try completely flattening gpt plus mbr with gdisk. sudo gdisk /dev/mmcblk0; type ? for help; type x for extra functionality; type z for zap, follow instructions and select both MBR and GPT for deletion. Thereafter run "sudo sync", yank the card, reinsert and see if gparted has a better time. – Alex Berry May 30 '17 at 15:54
  • @AlexBerry I don't think I've ever tried GPT on this card. Anyway, I've tried using `gdisk` but the behaviour was weird. I added the output to OP, what do you think? – iago-lito May 31 '17 at 05:22

0 Answers0