When playing with sdcards they sometimes turn up broken. If inserted in my macbook ‘s sdcard slot I get a message saying the card is not properly initialised. If I do try to initiliase with diskutil (graphical way) it still fails. Only solution left then is the following command.
fdisk -i /dev/rdisk1
Note that I’m using the raw disk image (rdisk1 instead of disk1s1). Normally it only overwrites the MBR so you should still get your data once done.
sage: fdisk [-ieu] [-f mbrboot] [-c cyl -h head -s sect] [-S size] [-r] [-a style] disk
-i: initialize disk with new MBR
-u: update MBR code, preserve partition table
-e: edit MBRs on disk interactively
-f: specify non-standard MBR template
-chs: specify disk geometry
-S: specify disk size
-r: read partition specs from stdin (implies -i)
-a: auto-partition with the given style
-d: dump partition table
-y: don’t ask any questions
-t: test if disk is partitioned
`disk’ is of the form /dev/rdisk0.
boothfs 8Mb boot plus HFS+ root partition (default)
hfs Entire disk as one HFS+ partition
dos Entire disk as one DOS partition
raid Entire disk as one 0xAC partition