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.
⚠️ 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:
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.
✅ 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:
- Open CMD as Administrator again.
- Type the following commands one at a time:
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 (usentfs
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:
- Open CMD as Administrator.
- Enter the following:
This removes the write-protection attribute.
✅ Optional: Use SFC to Scan System Files (if CMD tools fail)
If you suspect Windows issues:
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.