How to Restore Corrupted USB Flash Drives to Factory Settings (2026 Guide)
Have you ever yanked out a USB drive without safely ejecting it, only to find it’s no longer recognized by your computer? Or maybe you used it to boot a Linux distro, and now Windows refuses to format it. Don’t panic – your flash drive is likely not dead. In most cases, the partition table is simply corrupted. With a few commands in Windows’ built‑in diskpart tool, you can restore it to factory settings and make it work like new. In this 2026 guide, I’ll walk you through every step, from opening an elevated command prompt to cleaning the drive and creating a fresh partition. Plus, I’ll share beginner tips, common mistakes to avoid, and what to do if diskpart doesn’t see your drive.
Why Do USB Drives Get Corrupted?
- Improper ejection: Pulling out the drive while data is being written can corrupt the file system.
- Interrupted formatting: If you cancel a format or lose power, the partition table may break.
- Using as bootable media: Tools like Rufus or BalenaEtcher write special partitions that Windows sometimes can’t read.
- Virus or malware: Some infections hide or damage the drive’s structure.
Fortunately, most of these issues are fixable without any special software. The method below works for USB flash drives, SD cards, and even external hard drives.
What You’ll Need
- A Windows PC (Windows 10 or 11 – the steps are identical)
- The corrupted USB drive (at least 4GB – but works for any size)
- Administrator access on your computer
⚠️ Warning: This process will erase ALL data on the USB drive. If you need to recover important files, try data recovery software first. For that, read our guide on How to Recover Data from a Corrupted Hard Drive (the same principles apply to USB drives).
Step-by-Step Guide to Restore a Corrupted USB Drive
Step 1: Open an Elevated Command Prompt
Press Windows + R, type cmd, then press Ctrl + Shift + Enter to run as administrator. Alternatively, search for “Command Prompt” in the Start menu, right‑click it, and select “Run as administrator”.
Step 2: Launch DiskPart
In the black command window, type diskpart and press Enter. This opens the disk partition tool. You’ll see a new line starting with DISKPART>.
Step 3: List All Drives
Type list disk and press Enter. You’ll see a table of all storage devices connected to your PC. Identify your USB drive by its size. For example, a 32GB flash drive will show around 28‑30GB (due to formatting overhead). Be extremely careful – selecting the wrong disk (like your main C: drive) will erase Windows.
Step 4: Select Your USB Drive
Type select disk X (replace X with the disk number from the list). For instance, if your USB is Disk 1, type select disk 1. Confirm by typing list disk again – the selected disk will have an asterisk (*) next to it.
Step 5: Clean the Drive (Remove All Partitions)
Type clean and press Enter. This removes all partition and volume information from the drive. It takes only a few seconds. Do NOT type clean all unless you want a full secure wipe (which can take an hour).
Step 6: Create a New Primary Partition
Now type create partition primary and press Enter. This creates a single partition that uses the entire drive.
Step 7: Format the Partition
Type the following command (choose your file system):
format fs=exfat quick (recommended for drives larger than 32GB and for compatibility with Mac/Windows)
Or format fs=ntfs quick (if you only use Windows)
Or format fs=fat32 quick (for drives under 32GB and maximum device compatibility).
The quick option performs a fast format – perfect for restoring usability. Without “quick”, it does a full low‑level format (much slower).
Step 8: Assign a Drive Letter (Optional)
Type assign and press Enter. Windows will give the drive a letter (like E: or F:). If you skip this, you can assign one later in Disk Management.
Step 9: Exit DiskPart
Type exit twice to close DiskPart and the command prompt. Your USB drive is now restored and ready to use – it will appear in File Explorer as an empty drive.
📌 Real‑world example: A student used his USB to create a Kali Linux live drive. After the project, Windows showed the drive as “No media” or “0 bytes”. Following these steps, he cleaned the drive, created a new partition, and got back a fully functional 64GB USB in under 2 minutes.
Beginner Tips & Troubleshooting
- DiskPart doesn’t see my USB: Try a different USB port, or unplug and replug the drive. Also check if the drive appears in Disk Management (right‑click Start → Disk Management).
- “Clean” command fails: The drive might be write‑protected. Some USB sticks have a physical switch. For others, use
attributes disk clear readonlybefore cleaning. - USB still not working after format: The drive may be physically damaged. If it makes clicking sounds or gets very hot, replace it.
- I accidentally cleaned my main hard drive: Stop using the PC immediately. Use recovery software or contact a professional. Always double‑check the disk number.
Frequently Asked Questions (FAQ)
Can I recover data after using the “clean” command?
No. The “clean” command only removes the partition table, not the actual data. However, without a partition table, the data is very difficult to access. If you need files, stop using the drive and try recovery software before running “clean”.
What’s the difference between “clean” and “clean all”?
“Clean” only removes partition information (seconds). “Clean all” overwrites every sector with zeros (can take hours) and makes data unrecoverable. For most users, “clean” is enough.
Can I use this method on a Mac or Linux?
Yes, but with different commands. On Linux, use fdisk or gparted. On Mac, use diskutil. However, the Windows diskpart method is the simplest for Windows users.
Why does my 32GB USB show only 28GB after formatting?
That’s normal. Manufacturers define 1GB = 1,000,000,000 bytes, while Windows uses 1GB = 1,073,741,824 bytes. Also, the file system reserves some space for metadata.
Will this fix a USB that is write‑protected?
If the drive has a physical write‑protect switch, slide it to unlock. If it’s a logical write‑protection, run diskpart, select the disk, then type attributes disk clear readonly. Then try cleaning.
Related Posts You Might Like
- How to Recover Data from a Corrupted Hard Drive
- How to Remove Any Virus from Windows (Step by Step)
- 7 Signs Your Phone Has Been Hacked – And What to Do
- What is Cyber Security? Complete Beginner’s Guide
- Original Article: Restore Corrupted USB Flash Drives
Final Thoughts
Knowing how to restore a corrupted USB drive is an essential skill that can save you money and frustration. Instead of throwing away a “broken” drive, you can bring it back to life in minutes. Remember to always safely eject your USB drives, and keep backups of important files. For more PC troubleshooting and cybersecurity tips, subscribe to our YouTube channel and explore other Domebytes guides.
▶ SUBSCRIBE TO OUR YOUTUBE CHANNEL