I have a SD card that has some issues and I could not fixed them.
This is how the disk looks like in GNOME Disks:
When I run gdisk /dev/sdb
, it gives the following output:
sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.3
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
Warning! One or more CRCs don't match. You should repair the disk!
Partition table scan:
MBR: hybrid
BSD: not present
APM: not present
GPT: damaged
Found valid MBR and corrupt GPT. Which do you want to use? (Using the
GPT MAY permit recovery of GPT data.
I am not sure which partition table should I use but I used GPT (create blank GPT was not helpful)
This is how the partitions are look like:
Command (? for help): p
Disk /dev/sdb: 125067264 sectors, 59.6 GiB
Model: Multi-Card
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 76A0F070-E171-475B-9409-53840D61AD12
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 4194270
Partitions will be aligned on 2048-sector boundaries
Total free space is 671677 sectors (328.0 MiB)
Number Start (sector) End (sector) Size Code Name
1 2048 67583 32.0 MiB 0C01 hassos-boot
2 67584 116735 24.0 MiB 8300 hassos-kernel0
3 116736 641023 256.0 MiB 8300 hassos-system0
4 641024 690175 24.0 MiB 8300 hassos-kernel1
5 690176 1214463 256.0 MiB 8300 hassos-system1
6 1214464 1230847 8.0 MiB 8300 hassos-bootstate
7 1230848 1427455 96.0 MiB 8300 hassos-overlay
8 1427456 3524607 1024.0 MiB 8300 hassos-data
I will get this Info when I want to verify the disk:
Caution: The CRC for the backup partition table is invalid. This table may
be corrupt. This program will automatically create a new backup partition
table when you save your partitions.
Problem: The secondary header's self-pointer indicates that it does not reside
at the end of the disk. If you've added a disk to a RAID array, use the 'e'
option on the experts' menu to adjust the secondary header's and partition
table's locations.
Identified 2 problems!
I could managed to fix these problems and then I got this massage:
No problems found. 121544637 free sectors (58.0 GiB) available in 2
segments, the largest of which is 121542623 (58.0 GiB) in size.
but after writing I got this:
OK: writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
But when I check the partitions again, it is still the same.
I have tried to delete all partitions one by one and then create a new empty GUID partition table but after writing I got this:
OK: writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
But when I check the partitions again, it is still the same. I think it is because of the of hybrid MBR and damaged GPT. Is there any way to delete both of these tables at the same time? Or what can I still do to fix this problem?
Thanks in advance
Best Answer
I actually had this same problem recently. Your SD card may be in some kind of write-protected mode. Possible causes:
In my case, the flash disk controller was silently discarding my writes after the flash memory failed, so even though the writes looked successful, the corrupted partition table came back on the next read.
If your SD card is behaving like this, it has most likely failed, and you'll need to get a new one.
I suspect that you are having the first issue because if the write-protection switch was active, you would be seeing some kind of "read-only" notice, as Linux can detect if a flash disk or SD card is write-protected. (See
/var/log/syslog
)Example of a write-protected flash drive,
/dev/sdc
:Demo
/dev/sdb
was my broken flash drive that silently discarded writes.Tried wiping out the partition table:
The bad partition table immediately returned:
Erasing the beginning of the disk with
dd
didn't have any effect, either: