Wondershare Recoverit

Memory Card Recovery

  • Retrieves data from all types and brands of memory cards
  • Supports the recovery of over 1000 file types stored on memory cards
  • Capable of recovering data regardless of the cause of your SD card data loss
  • The intuitive interface enables simple 3-step memory card data recovery
  • Offers both quick and deep scanning options to locate and restore all missing data
Free Download Free Download Free Download Learn More >
memory card recovery

All You Need on Formatting SD Card Using CMD

Wondershare Recoverit Authors

Nov 11, 2024 • Filed to: SD Card Solutions • Proven solutions

Ever wondered how to format an SD card using CMD? There are many ways to format an SD card. You probably already know how to do it on your phone or a PC using Windows Explorer. But sometimes, these options may not be available or cannot work.

Formatting a memory card is necessary when it shows signs of corruption. If you notice that it isn't working the way it's supposed to work, you should consider a CMD memory card format. This will erase everything on the storage and rewrite the file system.

Important Terms Before Formatting SD Card Using CMD

Before we get into the nitty-gritty of formatting an SD card using CMD, there are some concepts you need to understand.

1. What's An SD Card and How Does It Work?

An SD card is storage media common on digital cameras, cell phones, laptops, baby monitors, and many more devices. The card is small and portable. This portability makes it ideal for transferring data between devices.

2. When Do You Need to Format SD Card?

There are two main reasons you may need to format an SD card:

  • The first reason is that the SD card begins to act up and cannot function normally. You may notice that it is undetectable in a device and cannot save, or you may encounter a case of missing files.
  • The second one is that you no longer need the card's data, and you want to erase it so you can use it as a new memory card.
Tips

If you accidentally delete important files when you format your SD Card, check out how to recover all your files safely.

3. What's CMD and How Does It Work?

CMD is an abbreviation for Command. It is a common reference to the Windows Command Prompt, a powerful interpreter that executes commands once entered by the user. Its executable command is cmd.exe. There are several ways to launch CMD depending on your Windows version. In Windows 10, typing Command Prompt in the Windows search bar at the bottom left of a Windows PC will launch the program.


[Video Tutorial] How to Format an SD Card on Mac and Windows?

recover unsaved powerpoint-video tips

Recent Videos from Recoverit

View More >

What SD Card Issues Can CMD Resolve?

The Command Prompt is a powerful utility that gets things done when other methods fail. Below are CD card issues that CMD can quickly resolve.

Issue 1: Corruption

SD card corruption happens because of power, hardware, or software failure. It can also happen because of an infection by a computer virus. There are many symptoms that corruption has occurred but below are the most common:

  • You get error messages. If you get an error message anytime, you try to use the card. Then there is a likelihood it is corrupted.
  • Missing files on the storage. If you have ever found yourself in a situation where you can swear you saved a file correctly but can't find it, then you could be dealing with a corruption issue.
  • The SD card is undetectable when connected to a PC. When you connect the memory card to a PC, it should appear in the list of drives. If it doesn't, then you have cause to suspect corruption.

In such situations, the chkdsk command can repair a damaged SD card using CMD.

Issue 2: Read-Only and Hidden Files

If you encounter a situation where you get an error message that the stick is read-only or find that you can't view some files, you can use CMD to resolve such issues.

Using a CMD utility known as Diskpart, you can remove the read-only attributes of files on any storage and clear the hidden status of hidden files.

Issue 3: Formatting

This refers to the process that completely deletes the storage media and recreates a file system. You can format a memory card using CMD, a device such as a phone, or other PC utilities available in Windows. In CMD, the main way to do this is to use the Diskpart utility, which we explain in the next section.

One important thing to note before you use CMD to repair or format a memory stick is to make a backup, so you don't lose all your data. To back up, connect the memory stick to a computer and copy all the files to a folder on the computer. You can also back up your files to the cloud using a cloud storage app such as Google Drive, Dropbox, OneDrive, or any other preferred cloud storage service.


How to Format SD Card Using CMD

The instructions that follow are for how to format an SD card using CMD in Windows 10. It takes less than ten minutes to get this done and is one of the most robust ways to format an SD card.

To begin, connect your SD to your computer and make sure it is recognizable. Then follow the steps below.

Step 1: Open Command Prompt

Next, fire up Command Prompt by navigating to the Windows Search bar at the bottom left of your screen and type Command Prompt. Ensure you run it as an administrator, or you won't be able to execute commands.

launch command prompt

Step 2: Start Diskpart

Next, type diskpart and hit Enter. This will take you into a screen such as the one shown below.

start diskpart cmd

Step 3: List the Disks

Type, list disk, to identify your disk from a list of disks.

diskpart list disk

Step 4: Select Your SD Card from the List

Note your disk number and then type in the command select disk followed by the disk number. This will select your SD card.

diskpart select disk

Step 5: Clean the SD Card

Next, type the command clean and hit Enter. This command erases everything on the SD card.

diskpart clean disk

Step 6: Create A New Partition

You now need to create a new partition on the memory stick. To do this, type in the command, create partition primary, and hit Enter.

diskpart create partition primary

Step 7: Run the Format Command

Next, type in the command format fs=fat32 and hit the Enter button. The letters fs are an abbreviation for the file system, whereas fat32 is the file system known as File Allocation Table. If you want your SD card to store files over 4GB, format it using exFAT.

diskpart format command

Step 8: Assign a Drive Letter

To complete the process, assign the SD card a drive letter so you can access it from Windows Explorer. Do so by typing, assign letter f. The letter can be any letter of your choosing.

diskpart assign drive letter

That's how to format a memory stick using CMD. But this isn't the only way. As mentioned, you can also format it using a phone or other features in Windows.


Tips When You Cannot Format Memory Card with CMD

Formatting an SD card using CD is one of the most powerful formatting methods. But there are a few instances when this may fail.

Why CMD Cannot Format Memory Card?

If you get an error message, then the following could be the causes. We offer some solutions on how to fix these issues.

Solution 1: The SD Card is Read-Only

In computing, read-only status refers to a situation where a computer file, memory, data, or a device is accessible via digital means but immutable. In this context, a read-only memory card means the contents can be read by device, but you can't save any new content, delete or manipulate the existing content. In computer lingo, the device is write-protected.

There are two ways to turn off the read-only feature on a memory stick.

Physical Switch

The first method involves moving a physical switch on the card. Some cards come with this feature out-of-the-box. Examine the memory card and see if there is a lever that you can slide to turn-off the read-only.

remove sd card write-protect

Once you do this, try to format the SD card again.

Remove Read-Only Attributes

The second method involves removing write protection that has been introduced via a software command. This command is executable using a computer or encryption tools on a mobile phone.

Read-only attributes on an SD card cause the formatting process to fail. If you encounter an error message using the method provided in the section on formatting an SD card using CMD above, repeat the steps and introduce an extra step:

Step 1: Navigate to the Windows Search bar at the bottom left of your screen and type Command Prompt. Run as an administrator.

Step 2: Type diskpart and hit Enter.

Step 3: Type list disk.

Step 4: Type in select disk followed by the disk number.

Step 5: Type attributes disk clear readonly.

Step 6: Type clean and hit Enter. This command erases everything on the memory stick.

Step 7: Type create partition primary and hit Enter.

Step 8: Type format fs=fat32 and hit the Enter button.

Step 9: Type assign letter f. The letter can be any letter of your choosing.

attributes disk clear readonly

You will notice we have introduced an extra command in bold above, which is attributes disk clear readonly. This removes the write-protection feature on the SD card.

Solution 2: File System Corruption

If there is a problem with the SD card file system's integrity or there are bad sectors on the SD card, then formatting may fail. In such a scenario, we recommend using the chkdsk command in CMD.

Chkdsk is the short-form of Check Disk. This is one of the most powerful utilities you can find in the command prompt. There are two instances when this tool can come in handy:

Begin by connecting the SD card to the computer and noting the drive letter in Windows Explorer.

To run chkdsk, open the command prompt from the Windows search bar.

Next, type chkdsk h: /f. H denotes the memory card drive letter while /f is a command parameter that instructs the utility to fix any errors found.

cmd chkdsk command

There are other parameters you can use with chkdsk to perform various functions. These include:

Chkdsk is a powerful tool, and it is recommended that you run it periodically on an SD card to keep it in tip-top shape.

Solution 3: SD Drive Letter Not Visible

To format an SD card in CMD, it must first be recognizable by the computer. Fix this by changing the drive letter using the Windows Disk Management utility. To do so, follow these steps:

change drive letter paths

Solution 4: Virus Infection

A computer virus can make a memory stick unusable. Connection to a PC may not be possible. The PC itself may also be infected. You can tell that the memory card has a virus if all the solutions fail, and the card behaves abnormally.

To remove a virus, first, ensure the PC is free from viruses.

Install or update antivirus software on the PC and run a scan. Many free antivirus programs do a good job. They include AVG Antivirus and McAfee.

sd card virus scan

The antivirus program will scan and clean the PC.

Next, connect the SD card and scan it.

If there is a virus, the scan expunges it, and you will get a message stating the same.

Once you get a clean bill of health, repeat the SD card formatting process.


Tips When SD Card Files Are Lost After Formatting SD Card

One thing you should do before formatting an SD card using CMD is to perform a data backup. The reason is that formatting erases all data and recreates the file system.

Therefore, failure to back-up could leave you with a bad taste in your mouth when you realize you have lost all your favorite photos, videos, and important documents.

There are various ways to backup an SD card. These include:

But, if you did not take this important step and lost all your data, do not fret. You can always turn to Wondershare Recoverit data recovery software.

To use the software, download it from the Recoverit webpage on the Wondershare website and install it. Next, launch the tool by clicking the shortcut icon on the desktop or type "Wondershare Recoverit" in the Windows search bar. Click and follow the steps below.

Step 1: Locate the SD Card

Once the application is up and running, locate the SD Card in the interface and click the Start button.

locate sd recoverit

Step 2: Scan the SD Card

The application scans the storage media to find lost files and begins the recovery process. You can see what's happening in real-time in the progress bar.

recover sd files recoverit

Step 3: Recover the Files

In the next screen, select the files you want to recover and click Recover. Save the selected files on a location on your computer.

recoverit save files

Even though formatting erases all the data on a memory stick, it is still retrievable using this special tool. The tool performs a deep scan of the memory card, reconstructs the deleted data, and lets you save the recovered files on a location on your computer.


Tips to Maximize the Usage of Memory Card

It is common for people to leave toss memory cards in desk drawers, leave them in hot and humid areas such as bags, or even leave them in hot cars. Little do they know that a memory card's life depends a great deal on its usage and storage. The following are a few tips to maximize the usage of your SD card.

Use It on One Device

While a memory stick is usable on many devices, it is not good to do so. If possible, use it only on one device, and if you need to use it on a different device, back it up and then format it first.

Avoid Magnetic Fields

Data stored on conventional storage devices are susceptible to destruction when it comes into contact with a magnetic field. Keep your storage media away from magnets and anything that produces a magnetic field.

Water, Dust, and SD Cards Don't Mix

Dust is a big factor in any storage becoming ineffective. When storing the memory stick, keep it covered in a plastic container. The same goes for water. SD cards are not waterproof. Please do not go into a swimming pool with them and avoid carrying them in the rain.

Just Be Good to It

Finally, use some common sense when taking care of memory sticks. Treat them the same way you would anything delicate. Do not subject them to physical impact, and be gentle when inserting them into a device.


Closing Words

The CMD utility is a powerful tool that executes various functions in Windows. The Microsoft Website has a detailed command line reference if you want to further your knowledge on using this utility. The diskpart command interpreter is a great way to manipulate local drives and removable media like SD cards. This tool would rarely not format the SD card in CMD, but in the event it does so, you can always follow the solutions to troubleshoot and fix the problem.

Recoverit author

Eleanor Reed

staff Editor

Home > Resources > SD Card Solutions > All You Need on Formatting SD Card Using CMD