3 Proven Ways to Fix a Corrupted Flash Drive with CMD (Diskpart/CHKDSK)

Is your USB drive refusing to open, showing strange errors, or suddenly becoming inaccessible? Don’t rush to throw it away just yet. With a few simple Command Prompt (CMD) commands, you can often repair your flash drive, recover valuable files, and save yourself the cost of buying a new one. Below, you’ll discover the exact steps using CHKDSK and Diskpart—two of Windows’ most powerful built-in repair tools.

However, Windows Command Prompt (CMD) can repair a flash drive using CHKDSK or Diskpart—but let’s be honest: the process is technical, time-consuming, and risky if you’re not comfortable typing exact commands. One wrong step could even wipe your data. That’s why most users prefer free flash drive repair software, which makes the same fixes possible in just a few clicks.

Why Choose Repair Software Over CMD?

Here’s why we recommend software first:

  • User-friendly: No confusing commands—just a clear, guided interface anyone can use.
  • Safer for your data: Software minimizes the risk of accidental formatting or data loss that can happen with CMD.
  • Faster results: Most tools detect and repair errors automatically, saving you time and frustration.

In short, while CMD is powerful, flash drive repair software gives you the easiest, safest, and most reliable way to bring your USB back to life. If that doesn’t work, then—and only then—should you consider CMD as a backup option.

Free USB Flash Drive Repair Tool - Fix Bad Sectors & More

IM-Magic Partition Resizer is a free tool that can help repair damaged USB flash drives. It offers a variety of features to repair, clone, and manage flash drives efficiently. Key features include:

  • Check USB Flash Drive Health: Detect file system errors and monitor drive condition.
  • Scan for Bad Sectors: Identify and repair soft bad sectors on the USB flash drive.
  • Remove Write Protection: Regain control over your USB flash drive.
  • Format RAW USB Flash Drive: Convert to NTFS, FAT32, or other formats.
  • Reset and Erase USB Flash Drive: Wipe the drive for a fresh start.
  • Change Drive Letter: Modify assigned drive letters for better organization.
  • USB Flash Drive Cloning: Transfer data from a failing USB flash drive.

Download Free for Win 11-7 Read more...

Part 1: Repair damaged USB flash drives using the "Check Partition" feature.

format tool
  1. Step 1: Download the software and connect your USB flash drive to the PC.
  2. Step 2: Right-click the USB flash drive in the software and select "Check Partition" to start the repair.
  3. Step 3: Confirm the repair settings and click 'OK' to begin the process.

repair bad sectors

Part 2: Clone the damaged USB flash drive to another drive for free using Partition Resizer.

  1. Step 1: Download the tool and connect your USB flash drive to the PC.
  2. Step 2: Right-click the USB flash drive in the software and choose "Copy Disk" to start cloning.clone hard drive
  3. Step 3: Choose the target drive for the backup (ensure the destination drive is larger).
  4. Step 4: Click 'Apply Changes' to begin cloning your USB flash drive.

recommendRecommend: 8 free usb drive repair software [easy to use]

3 CMDs to Fix Damaged Flash Drive

Here are the exact command lines that you may use for fixing damaged pen drive if you insist on using cmd to get the repair job done.

Must read: Recovering data from damaged flash drive with free tools like iCare Recovery Free is required before any repairing with cmd since the cmd is also kind of storage media rebuilding that would bring data destroyed or removed, especially the diskpart format cmd. downloadDownload

CMD 1 - Fix corrupted pen drive with cmd chkdsk /f

Open your computer, connect your flash drive to your PC, and then remember its drive letter since it would be used in cmd chkdsk

chkdsk h*: /f

(* h is drive letter that you need to change to your own usb flash drive drive letter)

cmd chkdskk to repair sd cardcmd chkdsk to repair pen drive

Video Guide - how to repair damaged pen drive using chkdsk

CMD 2 - Fix corrupted pen drive with cmd chkdsk /f /r

chkdsk /f/r i:

This time, you may use another cmd chkdsk /f/r i: when i is the drive letter that you need to replace it with your own flash drive drive letter.

CHKDSK f r

CMD 3 - Fix corrupted pen drive with cmd diskpart format command

This one works for most damaged pen drives when it has raw format, unreadable error, flash drive 0 bytes...

  1. Step 1 - Open cmd by pressing "Windows icon + R"
  2. Step 2 - Type diskpart
  3. Step 3 - Type 'list disk'
  4. Step 4 - Type 'select disk *' (You need to select the one that represents your flash drive)
  5. Step 5 - Type 'clean'
  6. Step 6 - Type 'create partition primary'
  7. Step 6 - Type 'format fs=ntfs quick', or type 'format fs=fat32 quick', or you may use 'format fs=exfat', or 'format fs=ntfs' with no quick included when quick means quick format in Windows.

cmd to format samsung sd

Note: if your flash drive was infected by virus, you may undelete files from flash drive after virus using cmd.

What is Diskpart

Diskpart is a Windows command line that is built with many functions including cleaning disk information, formatting disk file system, changing properties...

See more professional information about diskpart on Microsoft.com

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/diskpart

What is CHKDSK

CHKDSK (pronounced check disk) is a command that displays a status report for a volume, such as a disk/flash drive with main function to correct any errors found in that storage device.

The Verdict

The cmd command lines are advanced computing knowledge for advanced users. There could be some minor errors happen to non-techie users, for example you may wonder whether there should be any space among letters or should it need any : in between...

It's easy to get lost when using the cmd for starters so we strongly recommend users use free usb repair utilities instead of the cmd for repairing damaged flash drives.

freeQuick fix -> how to fix usb drive raw to fat32

Hot Articles