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:
- Start with the SD card not connected to the computer.
- Open an Administrator command prompt. Use it for the following commands.
- Open the
diskpart
tool in CMD. - Make sure Windows doesn't try to automatically mount the SD card when you plug it in. First, run
automount scrub
, thenautomount disable
. - Insert the SD card into a reader. Windows should seemingly ignore it.
- Use the
list disk
command to find your SD card, andselect disk <#>
to select it. If you can't find it, runrescan
and then try again. - 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 normalclean
doesn't work, tryclean all
; this zeroes the entire disk (or SD card), taking much longer but being much more of a sure thing. - Use the
create partition primary
command to create a new partition filling the SD card. This partition should by automatically selected, but you can uselist partition
/select partition 1
to make sure. - Format the new partition. Run
help format
for info about formatting options, but by default a simpleformat quick
should be sufficient (will use FAT32 or exFAT depending on size, I believe). - Use the
assign
command to give the newly-formatted SD card a drive letter. Hopefully at this point Windows doesn't freak out. - Restore volume auto-mounting (unless you want to leave it off) via
automount enable
. - Quit back to CMD using the
exit
command. - 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
.