2

I have a 64GB micro sdcard which was removed from an android phone without unmounting (could not find unmount after upgrade to android 7.1,they tried to make it easy and intuitive - it is an eject icon, 6 levels deep in the menu, so cannot be found by search for "unmount")

now the sdcard can be mounted and unmounted, data can be copied from it, but writing to it, deleting files or formatting it or writing new partition table is no longer possible; deleting files appears to work, but after unmount and mount again, everything is back to the way it was when it first started erroring out while copying files to the micro sdcard from linux; so writing to the card worked for a few mount/unmount cycles after taking the card out of the android phone without unmount;

trying to format it in the android phone errors out; in a camera, it says memory card locked; in ubuntu 18.04:

lsblk
mmcblk1      179:24   0 59.5G  0 disk 
└─mmcblk1p1  179:25   0 59.5G  0 part 

Create Partition Table

sudo gparted
Input/output error during write on /dev/mmcblk1


sudo hdparm -I /dev/mmcblk1p1
/dev/mmcblk1p1:
 HDIO_DRIVE_CMD(identify) failed: Invalid argument


sudo hdparm -I /dev/mmcblk1
/dev/mmcblk1:
 HDIO_DRIVE_CMD(identify) failed: Invalid argument


sudo hdparm -v /dev/mmcblk1
/dev/mmcblk1:
 HDIO_DRIVE_CMD(identify) failed: Invalid argument
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 1949664/4/16, sectors = 124778496, start = 0


sudo hdparm -L 0 /dev/mmcblk1p1
/dev/mmcblk1p1:
 setting drive doorlock to 0 (off)
 HDIO_DRIVE_CMD(doorlock) failed: Invalid argument


sudo gnome-disks
Error while repairing filesystem
on dev/mmcblk1p1
Process reported exit code 1: fsck.fat 4.1(2017-01-24) (udisks-error-quark, 0)


sudo fsck /dev/mmcblk1p1
fsck from util-linux 2.31.1
fsck.fat 4.1 (2017-01-24)
0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.
1) Remove dirty bit
2) No action
? 1
Perform changes ? (y/n) y

fsck does not error out, but running it again, everything is back as before.

sudo mkfs.vfat -n 64 /dev/mmcblk1p1 
mkfs.fat 4.1 (2017-01-24)

format does not error out, but when mounting again, everything is back as before.

testdisk
Disk /dev/mmcblk1 - 63 GB / 59 GiB - CHS 1949664 4 16
Current partition structure:
     Partition                  Start        End    Size in sectors
 1 * FAT32 LBA               32   0  1 1949663   3 16  124776448 [64d]
Warning: Bad starting sector (CHS and LBA don't match)


sudo dd if=/dev/zero of=/dev/mmcblk1 bs=512 seek=1

stopped it by control-c after 4GB, still no changes, files are still there, cannot write to micro sdcard

Basically, it seems that formatting, gparted writing a new partition table, fsck clearing the dirty bit, even writing with dd, all have no effect. The micro sdcard is not physically damaged, mount/unmounts just fine, which is why I thought that formatting it, and if not, then using gparted to write a new partition table should totally clear it and make it like new again. What am I missing? Why can't I format it? Is there something else I can try? It is as if it has some settings in there which cannot be accessed by these tools; it is a transcend micro sdcard

edit: tried to format the micro sdcard on windows xp, it said the card is read-only; connected with a usb micro sdcard adapter which showed the card as 32GB, and then with a multicard reader (micro sdcard into sdcard adapter into reader, usb out of reader) which showed 60GB and read-only; the problem is not the adapter, as I inserted the card in a laptop with ubuntu 18.04 that has a micro sdcard slot, so no adapter, and also in an android phone, again, no adapter;

tried mkusb-dus, but it refuses to wipe or reset the card

tried dd to overwrite entire card, but after mounting it again, everything is still there; files can be copied but not deleted; cannot create partition table to reset sdcard

I read there is a read-only diskwide attribute I will try to see if I can reset that

  • Take a look at this. – Mitch Feb 27 '19 at 6:28
  • After reading your edited question: I'm sorry, but I think that your card's hardware is damaged, read-only, 'gridlocked'. You have really tried in many ways, but the card shows typical signs, that it refuses all attempts to write to it (including with mkusb and dd). – sudodus Mar 4 '19 at 12:12
1
  • Please backup (copy) all important files from the card before you start repairing it.

  • You can analyze the problem according to this link,

    Analysis of the problem

    I hope you will be able to make the card writeable again by removing some data in the first mibibyte, that make the write tool unwilling to work. Otherwise you will at least understand what is wrong and why the card is read-only (for example that it is 'gridlocked'.)


  • mkusb is a very nice tool, +1 – jmarina Mar 6 '19 at 13:39

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.