143

I wish to reformat my SD card to use normally again (it currently has one 78 MB FAT32 partition and one 3.9 GB Linux partition). How do I do this (on Windows/Mac/*nix)?

4
  • 2
    This might sound very funny, but if you have a microsd that linux doesnot read but is shown using fdisk then, put it in your android phone, go to settings > Storage > Removeable Storage > Format. That's it. You can use it like a normal storage device thereafter. I just did it after doing all the yada yada for 1-2 hours Aug 26, 2016 at 17:26
  • not sure if there are any downsides to @freerunner 's suggestion but it surely is easy and worked just fine for me.
    – Triamus
    Oct 21, 2017 at 12:06
  • I can't post an answer, but the easiest way to do this in Windows in 2021 is to use the builtin Disk Management, which will let you delete even non-Windows partitions and then create a new partition in the empty space. (It apparently didn't allow that back in 2012) Apr 14, 2021 at 6:56
  • Some larger cards use EXFAT format instead of FAT32. Format was initially MS proprietary but is now supported by Linux. For command line fans, mkfs.exfat is installed with "sudo apt install exfatprogs". Use parted or fdisk (or any partitioning tool) to repartition and create the single big partition to format. Mar 31, 2023 at 23:03

8 Answers 8

196

You can use DISKPART in Windows, or the equivalent fdisk command under Linux/Mac.


DISKPART (Windows)

Start a command prompt, and start the DISKPART console. List all of your disks by typing LIST DISK, then select the proper disk with SELECT DISK # (where # is the SD card). You can then type CLEAN to clear the partition table on the card, effectively blanking it. MAKE SURE YOU SELECTED THE PROPER DISK BEFORE RUNNING THE CLEAN COMMAND!

To create a primary partition to reuse the space on the card, type CREATE PARTITION PRIMARY. This will then reallocate the previously "cleaned" space.

To format, type FORMAT FS=FAT32 QUICK, and finally, to reassign a drive letter, type ASSIGN.

If you're unable to determine the proper disk, remove the SD card, run DISKPART and LIST DISK, and then re-run it with the SD card inserted. The SD card is just the disk that has been added.

Note that the above commands are not case sensitive; I used caps to match the convention DISKPART displays.


FDISK / CFDISK (Linux/Mac)

In a terminal, start fdisk /dev/sdx where /dev/sdx is your SD card device (may depend on the Linux distro you're using, see below). You can then delete all existing partitions on the device by typing d, and then adding a single new partition & format it. You an also just type n to create a new partition table, and start laying everything out.

cfdisk is also another viable tool, which is basically fdisk with a greatly improved user interface. In both cases, once the drive is formatted, you will lastly need to mount it.

If you're unable to determine the proper device, remove the SD card, run fdisk -l, and then re-run it with the SD card inserted. The SD card is just the device that has been added.

2
  • @AlexChamberlain in DISKPART, you can generally tell by the capacity of the disk. Once you select a disk, you can also call LIST VOLUME to see all the drive volumes and their labels (so long as your SD card's name shows up, you have the right device). If you're using fdisk, type p to print the partition table and check that the volume labels are correct. If you're using cfdisk, it should show you the volume labels right after you start the command on a device. Aug 4, 2012 at 14:12
  • I have a 64GB SD-card. Diskpart tells me, it's too big to be formatted in fat32. Is there any option to do it anyway? Or do I have to use 3rd-party software? Dec 27, 2017 at 16:57
18

On your camera

Most cameras have a built in Format function, which will use a single FAT partition. My camera even puts it on an erase block boundary.

For example, on my Pansonic Lumix, having inserted the card and from any mode, the menu as a Format entry. Selecting it brings up a menu asking me to confirm I wish to delete all the data on the card. Selecting Yes formats the card.

3
  • 1
    :) It will be one FAT partition, starting at the second erase block. Aug 4, 2012 at 19:47
  • 3
    It'll be FAT Formatted like any other FAT formatted device… it's not camera specific. However, he'll have to delete various folders created like "DCIM"
    – Alexander
    Aug 4, 2012 at 22:38
  • I avoided this answer as it sounded like a bad way to do it, but nothing else here worked and this worked a treat. I removed all partitions, opened up the SD card in the camera, formatted and now have my 30GB available instead of the 1.4 showing. Jun 5, 2017 at 23:37
18

You can use the official SDCard.org application (Windows / Mac):

It's fairly simple and reformats the SD card in FAT32. There are options for LBA-adjustment and wiping / erasing as well.

2
  • At time of writing, this software doesn't even run on Windows 10. No errors, just bombs out immediately with a blank error number in the event log!
    – Grim
    Jul 28, 2018 at 10:26
  • Perfect solution, do not need to do anything just format and its done.
    – sairfan
    Dec 25, 2020 at 2:45
11

Currently, one of the best disk management utils seems to not have been mentioned - GParted:
pic of GParted

This is included in many Linux distros, and can be installed easily otherwise. For other systems, it is possible to run it off of a DVD or USB stick, so it can be used there as well. The Linux part also means it supports the SD card format if it is ext*, so it can be reformatted easily and efficiently, and less problems are likely to occur. Most disk utils, particuarly on Windows, will likely destroy any boot data on the SD card and muck it up in other ways.

Here a screenshot of GParted showing the contents of an SD card with Raspbian on:
screenshot of GParted
Note: The boot partition will likely have a label or flag 'boot'

To carry out operations on a partition of an, right click on it, and select 'Unmount'. If a partition is mounted (shown by a set of keys next to the partition name), no operations can be done on it. Once it is unmounted, you can check it for errors, reformat it, rename it, delete and create a new one, etc.

Documentation on using GParted can be found here

5

There are some specific tools for SD cards only, but I like to use EaseUS Partition Tool which is free for Windows users. It will not work on Server Editions. * Please be aware that apparently they are bundling some software. Click on advanced options to prevent this.

You should take care to select your SD card from the list of devices as this tool will list all your drives. This shows how to resize a partition.

Enter image description here

  • The best bet is to complete delete any partitions on the SD card. This will include FAT and ext and possibly a SWAP. Just delete them so you can see a full unallocated 16 GB.
  • No operations will be performed until you click APPLY. Once you have removed all partitions follow instructions to reload the distribution you like.

Hardware Error

If, however in the list you see your card listed as 55 MB in total size and have no option to remove or expand it more that means the SD may be broken.

You can use a tool called SD Memory Card Formatter - Go that page, read the terms, scroll down and accept if you agree. This software will only format external devices. Like SD Card or USB Device.

Select options QUICK and FORMAT SIZE ADJUSTMENT : ON!

enter image description here

That should reset the entire SD card to its original size. If an error occurs at this point it is more likely the card is completely damages.

As a last resort you can try and format the card in a dSLR camera or mobile phone that accepts the card.

Example

This is my 4 GB Raspbian SD card. I used Windows management tools. Yes, it shows it, but it won't let you do anything to the partitions just in case ... you delete it or Windows corrupts something (because it does not support that file system).

Enter image description here

EaseUS partition master shows a much better list and understands that file systems used. Right click and delete the partitions. You can create new partitions too and apply everything and you will have the whole SD card back to use in Windows or if you want to burn another image to the card.

Enter image description here

Here I have deleted the partitions. Right clicked and said "Create new partition". There is a whole list of file system types. I did not click apply, so no operation has been done yet.

Enter image description here

6
  • 2
    this program tries to install a number of other applications when you install it.
    – PhillyNJ
    Jun 7, 2014 at 0:05
  • Sorry when i wrote this that wasnt an issue. I have updated my anser to warn about this. I still feel its good software and I hope the downvote will be removed.
    – Piotr Kula
    Jun 9, 2014 at 8:17
  • Done - but I wouldn't install it. My Anti-virus software was blocking a ton of stuff from being installed.
    – PhillyNJ
    Jun 9, 2014 at 10:42
  • Might be a bit overkill for such a simple task, but it works.
    – Ivotje50
    Dec 30, 2014 at 16:03
  • 1
    My card was 60MB big, like you wrote in "Hardware Error", but instead of throwing it away, I formated it with my mobile phone, and is not 16GB again :)
    – greuze
    Aug 26, 2017 at 15:57
4

Something of note when using the official SD Formatter tool. (This really should be a comment, but apparently i can't add a screen grab to a comment.)

this tripped me up for a day or so. I ran the SD Formatter thinking it would repair my SD card. I observed that drive J: size was only 60Mb. It's a 16Gb card. I thought that (as per the format tool I've been using for the last 30 years) that it would only format the 60Mb partition.

MISTAKE. It actually repartitions the device to a single full-size partition and then formats it (in this case to its full 16Gb - see foreground window compared to background window). THIS This is the tool you need. Hands down. no questions asked!!

1
  • +1 for the 60MB problem that I have, that is finally not a problem 60MB => 16GB at the end if the card is 16GB :)
    – Basj
    Jul 29, 2016 at 17:09
-2

I had a very similar issue. My set up: Computer running on Windows 7 and Sandisk ultra card 16 GB.

I wanted to format my card for installing OpenELEC. So I downloaded SD formatter and tried formatting it. It became a 64 MB card! I tried multiple settings, tried diskpart on CMD and clean format using computer management/disk management console - no luck. Always winimg writer claimed there was no sufficient space on the card. Earlier (that is before using SD formatter) it will expand the space and will install, and I subsequently used expand command on the Raspberry Pi terminal. So here is what I did:

I downloaded BerryBoot (note it is 28 MB!), wrote the image on the SD card and booted the Raspberry Pi. BerryBoot reformatted the same using its own in built program. Now I took the card out and formatted it using the format tool on Windows with FAT. I took the card out and reinserted. Now it reads 14.4 GB! Any one stuck like this can try this out.

1
  • 4
    Windows will only see the small header partition that is left over when the card is formatted to Linux compatibility. So the card is still the same size, its just that windows cant understand the Linux parition and so completely ignores its existance. Much like linux does with that header partition. Jan 23, 2014 at 11:47
-4

It is no good on Mac with the latest OS X. The card can't be erased in any way.

3
  • 1
    Nonsense, what about fdisk?
    – Jivings
    Mar 29, 2013 at 9:34
  • @Jivings since I can't edit (due to my FAQ spree), how should I respond to this question while reviewing: flag, comment, etc? Mar 30, 2013 at 5:47
  • @xxmbabanexx Downvote probably. It is an answer, it's just wrong. And that's not a flaggable offense.
    – Jivings
    Mar 30, 2013 at 9:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.