1

I'm having issues trying to recover a corrupted micro-SD card (not the data, just the card). I think it was formated to be part of the internal storage of an Android phone when that was an option.

# lsblk -f
NAME            FSTYPE   LABEL UUID                                   MOUNTPOINT
sda                                                                   
├─sda1          vfat           8F38-5495                              /boot/efi
├─sda2          ext4           1d8431cf-f298-40af-be5d-413510537953   /boot
└─sda3          LVM2_mem       mjbdHc-7AHE-LwUO-IlCo-chqH-EVhA-BVN0i4 
  ├─fedora-root ext4           d38fec65-d7d1-40e2-9d16-dcbc0dcd6330   /
  ├─fedora-swap swap           6d365505-5e51-4bd5-8a93-bcd56ed1945d   [SWAP]
  └─fedora-home ext4           3f42f95e-85ce-44a6-9abf-474bf5ae3ab6   /home
sdb                                                                   
├─sdb1                                                                
└─sdb2

-

# fdisk -l /dev/sdb
Disk /dev/sdb: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 69704183-D789-43CC-A52A-6B69A888EA09

Device     Start      End  Sectors  Size Type
/dev/sdb1   2048    34815    32768   16M unknown
/dev/sdb2  34816 62333918 62299103 29.7G unknown

I tried fdisk /dev/sdb, it yields:

fdisk: cannot open /dev/sdb: Read-only file system

I checked the adapter and is not locked. I tried mount --options remount,rw /dev/sdb and it says:

mount: /dev/sdb: mount point not mounted or bad option.

without the remount option:

mount: /dev/sdb: can't find in /etc/fstab.

so apparently it's not mounted but still read only? anyway mount /dev/sdb1 /mnt/ does not yield an assertive error message:

mount: /mnt: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error.

Another output I got from reading stuff on the internet:

# e2fsck -f -n /dev/sdb
e2fsck 1.44.3 (10-July-2018)
e2fsck: Bad magic number in super-block while trying to open /dev/sdb

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>

Found a gpt partition table in /dev/sdb

also tried both variants suggested and got the same output. I'm not sure how to proceed as I can't get the card mounted (tried several filesystems) or even remove the read only condition. Any ideas?

1

Using an SD card in an Android device will mean that the data in encrypted (at least on a reasonably recent version of Android). This is why you can't mount the filesystem.

You can recover "normal" (i.e. FAT32) use of the SD card by doing the following:

  • use fdisk on it and create a new DOS partition table (command 'o'), and then create a primary partition and allocate all space to it; change the type to FAT32 (command 't' and type 'b'). Make the partition active (command 'a'). Save this.
  • create a new filesystem on the newly created partition with mkfs.vfat /dev/sdb1 (double-check the device name!).

Now the SD card can be used normally again. Of course you're free to use another filesystem on it, e.g. ext4 if you're only going to use it with linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.