I have a SanDisk 32 GB microsd card that i have been using for my smartphone. A few days ago the sd card crashed and i cannot access any files on my card.
I tried using testdisk utility as i did rescue my data earlier using it for my pendrive, but testdisk could not access any partition.
Then i tried using fdisk and deleting the partition and creating a new one:
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: 5CB171C8-5A20-4253-9A15-61DF908359A5
Device Start End Sectors Size Type
/dev/sdb1 2048 34815 32768 16M unknown
/dev/sdb2 34816 62333918 62299103 29.7G unknown
d
Partition number (1,2, default 2): 1
Partition 1 has been deleted.
Command (m for help): d
Selected partition 2
Partition 2 has been deleted.
Command (m for help): n
Partition number (1-128, default 1): 1
First sector (34-62333918, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-62333918, default 62333918):
Created a new partition 1 of type 'Linux filesystem' and of size 29.7 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Now this should have created a partition and saved it into the partition table but now when i am running fdisk again and looking at the partition table the sd card still has two partitions of unknown type.
Device Start End Sectors Size Type
/dev/sdb1 2048 34815 32768 16M unknown
/dev/sdb2 34816 62333918 62299103 29.7G unknown
I tried doing the same thing using gparted, formatted the partition to NTFS or Fat file format, it ran the complete process and showed the successful message, but it is back to the same thing again.
Something is stopping me to write on my sd card, as if its read only, so i tried the solution that i found on the internet:
sudo hdparm -r0 /dev/sdb
/dev/sdb:
setting readonly to 0 (off)
readonly = 0 (off)
Now when I am repeating all the steps it is not making any difference. I would like to know what is going on. I don't care about the data now, as you must have realized, I just want to know if I can use the card again.
This is very interesting actually too, what could have occured inside the card to render it read only?