Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Fix Corrupted USB Drive with CMD: Step-by-Step

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can often fix a corrupted USB drive using Command Prompt (CMD) on Windows. The built-in diskpart and chkdsk tools can repair file system errors, remove write protection, and reformat the drive. This guide walks you through the safest methods, from simple checks to a full format. Before starting, back up any data you can still access, because some steps erase everything on the drive.

What You'll Need

  • A Windows PC (Windows 10 or 11 works best).
  • The corrupted USB drive plugged into a USB port.
  • Administrator access to open Command Prompt.
  • Patience – some repairs take several minutes.

Step-by-Step

  1. Back up what you can. If Windows still shows the drive in File Explorer, copy your important files to another location. If the drive isn't recognized, skip to step 2.
  2. Open Command Prompt as Administrator. Press the Windows key, type cmd, right-click “Command Prompt” and choose Run as administrator. Click “Yes” if prompted by User Account Control.
  3. Run CHKDSK to repair file system errors. Type chkdsk E: /f /r (replace E: with your USB drive's letter) and press Enter. The /f flag fixes errors, /r locates bad sectors and recovers readable data. This can take a while; let it finish. If it says the drive is in use, close any open windows from the drive.
  4. If CHKDSK fails or the drive is still not accessible, try DiskPart to clean and reformat. In the same Command Prompt, type diskpart and press Enter.
  5. List all disks. Type list disk and press Enter. Note the disk number that matches your USB drive (usually Disk 1, 2, etc., based on size). Be careful – selecting the wrong disk will erase the wrong drive.
  6. Select your USB drive. Type select disk 1 (replace 1 with your disk number) and press Enter. You should see “Disk 1 is now the selected disk.”
  7. Clean the drive. Type clean and press Enter. This removes all partitions and data. Wait for “DiskPart succeeded in cleaning the disk.”
  8. Create a new partition. Type create partition primary and press Enter.
  9. Format the partition. Type format fs=ntfs quick (or fs=fat32 if the drive is 32 GB or smaller or you need compatibility with older devices) and press Enter. Wait for the format to complete.
  10. Assign a drive letter. Type assign and press Enter. This gives the drive a letter so Windows can see it.
  11. Exit DiskPart. Type exit and press Enter. Your USB drive should now appear in File Explorer as a fresh, empty drive.

Common Mistakes

  • Using the wrong disk number in DiskPart. Double-check the size and type before selecting. A wrong selection wipes your internal hard drive.
  • Skipping the CHKDSK step. If the drive has minor errors, a full format may not be needed. CHKDSK is less destructive.
  • Choosing the wrong file system. NTFS is fine for Windows-only use, but FAT32 is better for cameras, TVs, and older devices. exFAT is a good middle ground for large files.
  • Not running as administrator. Without admin rights, DiskPart and CHKDSK will fail with “Access denied.”
  • Pulling the drive out during repair. This can cause permanent damage. Always wait for the process to finish.

Tips

  • Use a USB port directly on the motherboard (back of the PC) rather than a hub, to avoid power issues.
  • If the drive is write-protected (shows “The disk is write-protected”), run diskpart, select the disk, then type attributes disk clear readonly before cleaning.
  • If you only need to fix file corruption and keep files, try chkdsk E: /f first (without /r) – it’s faster.
  • After formatting, safely eject the drive each time to prevent future corruption.

Troubleshooting

If CHKDSK says “The type of the file system is RAW” or “Cannot lock current drive”: The drive may be beyond simple repair. Go straight to DiskPart and clean/format.

If DiskPart says “DiskPart has encountered an error: The parameter is incorrect”: The drive may be physically failing. Try a different USB port, then a different computer. If it still fails, the drive is likely dead and needs replacement.

If the drive shows as “No Media” in DiskPart: This means the USB controller is not detecting the flash memory. There is no software fix; the drive is physically damaged.

If the format hangs at 0%: Close other programs that might be using the drive, and try a different USB port. If it still hangs, the drive may have bad sectors; try format fs=ntfs without the “quick” option, but this can take hours.

If Windows still doesn’t show the drive after formatting: Open Disk Management (right-click Start > Disk Management). If the drive appears as “Unallocated,” right-click and choose “New Simple Volume” to create a partition manually.

Frequently Asked Questions

Will CHKDSK delete my files?

No, CHKDSK repairs the file system and attempts to recover data. It does not delete files, but if the drive is severely corrupted, some files may become unrecoverable.

Can I fix a physically damaged USB drive?

No. If the drive has physical damage (e.g., broken connector, burnt chip), no software can fix it. DiskPart and CHKDSK only handle logical corruption.

What file system should I choose?

For Windows-only use, NTFS. For cross-device compatibility (TVs, car stereos), FAT32 if the drive is 32 GB or less. For large files (>4 GB) on modern devices, exFAT is best.

Why is my USB drive write-protected?

This can be a physical switch on the drive (if it has one) or a logical attribute. In DiskPart, use attributes disk clear readonly to remove the logical protection.

How long should CHKDSK take?

It depends on the drive size and corruption. A quick scan might take a few minutes; a full scan with /r can take over an hour. Let it run to completion.

Can I use CMD to recover deleted files?

No. CMD tools like DiskPart and CHKDSK do not recover deleted files. You need third-party recovery software, and it’s best to stop using the drive immediately to avoid overwriting data.