I can't write the partition table on an SD card. IOCTL error. I can't delete it, either, neither in Linux using parted, cfdisk, or fdisk, nor in Windows, which just says format didn't work. The partition table just will not go away, so I'm pretty sure those sectors of the disk have just failed for writing, but can still be read somehow.
Can I write the partition table to a different place on the disk?
The SD card is a 32GB Sandisk which I flashed with k3os.
More info:
TestDisk 7.1, Data Recovery Utility, July 2019
Christophe GRENIER <[email protected]>
https://www.cgsecurity.org
Disk /dev/sdd - 31 GB / 29 GiB - CHS 30437 64 32
Analyse cylinder 1084/30436: 03%
Read error at 1083/1/1 (lba=2218016)
check_FAT: Unusual number of reserved sectors 4 (FAT), should be 1.
FAT16 >32M 1 0 1 56 63 32 114688 [NO NAME]
Linux 58 0 1 1010 63 32 1951744 [root]
I tried writing zeroes to the first 512 bytes, but this was the result:
root@amnesia:~# dd if=/dev/sdd bs=512 count=1|hexdump
1+0 records in
1+0 records out
0000000 b8fa 1000 d08e 00bc b8b0 0000 d88e c08e
0000010 befb 7c00 00bf b906 0200 a4f3 21ea 0006
0000020 be00 07be 0438 0b75 c683 8110 fefe 7507
0000030 ebf3 b416 b002 bb01 7c00 80b2 748a 8b01
512 bytes copied, 0.0029971 s, 171 kB/s
0000040 024c 13cd 00ea 007c eb00 00fe 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
*
00001b0 0000 0000 0000 0000 e765 fb8c 0000 0080
00001c0 1001 030c 8fe0 0800 0000 c000 0001 0000
00001d0 a0c1 0383 ffe0 d000 0001 c800 001d 0000
00001e0 0000 0000 0000 0000 0000 0000 0000 0000
00001f0 0000 0000 0000 0000 0000 0000 0000 aa55
0000200
It really seems like I can't write to the first sector. Also, the read error at cylinder 1083 has been consistent every time I use testdisk on this card. Btw, I changed the disk geometry from 4 to 64 heads to make testdisk happy.
Smartctl errored out with no useful info. lsblk showed this:
root@amnesia:~# lsblk2 /dev/sdd
SIZE FSTYPE MODEL NAME SERIAL UUID
29.7G SD_Card_Reader sdd 000000000820
56M vfat ├─sdd1 D013-2C4C
953M ext4 └─sdd2 a3198349-8ae7-47cd-8ed7-26e09ba8146b
A tool called sdtool revealed "Write protection state: Off".
Is this just a bad sd card that I can't rescue?