Format a protected (corrupted) sd card

I have a linux command for you: hdparm

Set the readonly flag, card will be readonly:

markus@markus-ThinkPad-W530:~$ sudo hdparm -r 1 /dev/mmcblk0

/dev/mmcblk0:
 setting readonly to 1 (on)
 readonly      =  1 (on)

Clear the readonly flag, card wil be read-write:

markus@markus-ThinkPad-W530:~$ sudo hdparm -r 0 /dev/mmcblk0

/dev/mmcblk0:
 setting readonly to 0 (off)
 readonly      =  0 (off)

Query the readonly flag, 0 = readwrite, 1 = readonly:

markus@markus-ThinkPad-W530:~$ sudo hdparm -r /dev/mmcblk0

/dev/mmcblk0:
 readonly      =  0 (off)

Markus