How to Repair SD Card or USB Drive via CMD

CMD (Command Prompt) can help fix minor file system errors, bad sectors, or formatting issues on SD cards and USB drives without needing third-party tools.

How to Repair SD Card or USB Drive via CMD

⚠️ Before You Begin

  • Insert your SD card or USB into your PC.
  • Note the drive letter (e.g., E:, F:) shown in File Explorer.
  • Backup important data if possible.

Method 1: Using CHKDSK Command

The chkdsk (Check Disk) command scans and fixes file system errors.

🔹 Steps:

Open Command Prompt as Administrator

  • Press Win + S, type cmd, then right-click and select Run as administrator

Type the command:

chkdsk E: /f /r /x

Replace E: with your SD card or USB drive letter.

Explanation:

  • /f – Fixes any errors it finds.
  • /r – Recovers readable info from bad sectors.
  • /x – Forces the drive to dismount before fixing.

Press Enter and wait for the process to complete.

  • This may take several minutes.

Check the drive in File Explorer to see if it’s accessible.

Method 2: Rebuild the File System via DISKPART (if drive is not recognized properly)

⚠️ Warning: This will erase all data on the USB/SD card.

🔹 Steps:

  1. Open CMD as Administrator again.
  2. Type the following commands one at a time:
diskpart list disk select disk X clean create partition primary format fs=fat32 quick assign exit

Explanation:

  • list disk: Lists all storage devices.
  • select disk X: Replace X with your SD card/USB number (usually shown by size).
  • clean: Removes all partitions and data.
  • create partition primary: Creates a new usable partition.
  • format fs=fat32 quick: Formats with FAT32 (use ntfs if needed).
  • assign: Assigns a new drive letter.
  • After exiting, check File Explorer your drive should be ready to use.

Method 3: Fix Attributes (If USB/SD Card Is Write Protected)

Sometimes the drive is write-protected and can’t be formatted.

🔹 Steps:

  1. Open CMD as Administrator.
  2. Enter the following:

diskpart list disk select disk X attributes disk clear readonly exit

This removes the write-protection attribute.

Optional: Use SFC to Scan System Files (if CMD tools fail)

If you suspect Windows issues:

sfc /scannow

This checks for corrupted system files that may interfere with USB/SD detection.

🧾 Conclusion

Using CMD tools like CHKDSK, DISKPART, and ATTRIBUTES, you can recover or repair many common issues with USB drives and SD cards. These steps are free, built-in, and effective for both logical and minor hardware-related problems.

Post a Comment

Previous Post Next Post