Unable to format RAW SD card?

Solution 1:

Sounds like a hardware issue to me, most likely. You can try wiping the card with software, but there's no guarantees and this will wipe all data on the card if it succeeds. If you want to give it a shot, try the following:

  1. Start with the SD card not connected to the computer.
  2. Open an Administrator command prompt. Use it for the following commands.
  3. Open the diskpart tool in CMD.
  4. Make sure Windows doesn't try to automatically mount the SD card when you plug it in. First, run automount scrub, then automount disable.
  5. Insert the SD card into a reader. Windows should seemingly ignore it.
  6. Use the list disk command to find your SD card, and select disk <#> to select it. If you can't find it, run rescan and then try again.
  7. Run the clean command to wipe any partition data on the disk already, as (if it's a data issue, rather than a hardware one) that's the most likely place that problem could cause symptoms like you describe. This command does not, so far as I know, require reading the disk metadata, though I may be wrong. If a normal clean doesn't work, try clean all; this zeroes the entire disk (or SD card), taking much longer but being much more of a sure thing.
  8. Use the create partition primary command to create a new partition filling the SD card. This partition should by automatically selected, but you can use list partition / select partition 1 to make sure.
  9. Format the new partition. Run help format for info about formatting options, but by default a simple format quick should be sufficient (will use FAT32 or exFAT depending on size, I believe).
  10. Use the assign command to give the newly-formatted SD card a drive letter. Hopefully at this point Windows doesn't freak out.
  11. Restore volume auto-mounting (unless you want to leave it off) via automount enable.
  12. Quit back to CMD using the exit command.
  13. Go to the newly-assigned drive letter and see if you can use it.

Hope that works for you! You should be able to put the card back in the phone (after using Eject or Safely Remove Hardware in Windows!) and it should hopefully work.

Bear in mind, though, that if it's a hardware issues then at best you'll only put the problem off for a little while, and risk losing more time and data in the future. SD cards are relatively inexpensive but don't last forever; maybe you got a bad one that died early.

Solution 2:

In Windows this sbould be doable using the partitionmanagement (just search for it in start(menu)). Be sure to select the correct, removable, device.

Generally in Windows if you face errors, a look into the eventmanager is a good thing to do. Event Manager -> Custom Views -> Administrative Events should have some more detailed info on whag exactly failed.

If Windows doesn't "like" the card (anymore) you should be able to confirm whether it's really broken or not with attaching it to a Linux machine and watching the dmesg log while doing so. Usually it will just work fine and you can unmount the SD (if auto-mounted) and format it. Also zeroing the drive before might help:

dd if=/dev/zero of=/dev/sdXy
mkfs.fat -F 32 /dev/sdXy

be sure to replace sdXy with the correct device - you can also wrongly format an important drive! You can get an overview over devices using lsblk.