How Hackers Hack Phones And How You Can Prevent It

Read Blog

Amilma Analytics All-In-One Web Analytics

Learn more

20 Useful Ways Web Developers Can Leverage Grok AI

Read Blog

WordPress 22 Years Later: How the World’s Leading Website Platform Powers the Modern Web in 2025

Read Blog

Top 10 Microsoft Project Management Tools in 2025: The Ultimate Guide to Streamlining Your Workflow

Read Blog

Search

USB Drive Factory Reset: Complete Diskpart Guide

  • Share:
USB Drive Factory Reset: Complete Diskpart Guide

If you're getting errors when trying to format your USB flash drive in Windows File Explorer (such as "Windows was unable to complete the format"), you can still format the drive using Command Prompt. This comprehensive guide teaches you how to erase and reformat your flash drive using the DiskPart tool.

Why Use Diskpart for USB Formatting?

Diskpart is Microsoft's command-line disk partitioning utility that offers more control than the standard formatting tools. It's particularly useful when:

  • File Explorer format fails
  • USB drive shows incorrect capacity
  • Drive is corrupted or has bad sectors
  • You need to remove write protection
  • Standard formatting tools don't recognize the drive

Things You Should Know

Important Preparation Steps:

  • Plug the USB drive into your computer before starting
  • Run CMD or PowerShell as Administrator
  • Back up data: This process erases everything on the drive
  • Identify correct disk: Using wrong disk number can erase other drives

Step-by-Step Guide: Reset USB Drive to Factory Settings

Step 1: Plug Your USB Drive

Insert the USB drive into any available USB port on your computer. Wait for Windows to recognize it (even if it shows an error).

Troubleshooting: If the drive doesn't appear in File Explorer, it may still work with Diskpart.

Step 2: Open Command Prompt as Administrator

  1. Press Windows + R keys
  2. Type cmd and press Ctrl + Shift + Enter (opens as admin)
  3. Click Yes on the UAC prompt

Alternative method: Search "cmd" in Start menu, right-click, select "Run as administrator"

Step 3: Launch Diskpart

Type the following command and press Enter:

diskpart

You'll see the Diskpart prompt: DISKPART>

Step 4: List All Disks

Type and execute:

list disk

This displays all storage devices. Identify your USB drive by size. Example output:

Disk 0    238 GB   Online
Disk 1     32 GB   Online    <-- This is likely your USB drive
Disk 2    500 GB   Online

Warning: Double-check the size to avoid selecting the wrong disk!

Step 5: Select Your USB Disk

Replace [number] with your USB drive's disk number:

select disk [number]

Example: select disk 1

You'll see: "Disk [number] is now the selected disk."

Step 6: Clean the Disk

This removes all partitions and data:

clean

Wait for confirmation: "DiskPart succeeded in cleaning the disk."

What this does: Removes all partition information, making the drive like new.

Step 7: Create Primary Partition

Create a new partition:

create partition primary

Success message: "DiskPart succeeded in creating the specified partition."

Step 8: Format the Drive

Choose your file system. For USB drives, NTFS is recommended:

format fs=ntfs quick

File system options:

  • NTFS: Best for Windows, supports large files (>4GB)
  • FAT32: Compatible with all devices, but 4GB file size limit
  • exFAT: Good cross-platform compatibility, no file size limit

To use FAT32: format fs=fat32 quick
To use exFAT: format fs=exfat quick

Wait for: "DiskPart successfully formatted the volume"

Step 9: Assign Drive Letter

Assign a specific drive letter (optional but recommended):

assign letter=F

Replace F with any available letter. Windows will confirm: "DiskPart successfully assigned the drive letter or mount point."

Step 10: Exit Diskpart

exit

Your USB drive is now reset to factory settings and ready to use!

Advanced Options and Troubleshooting

Remove Read-Only Protection

If your USB is write-protected:

attributes disk clear readonly

Full Format vs Quick Format

For a thorough format that checks for bad sectors, omit "quick":

format fs=ntfs

Note: Full format takes much longer but is more thorough.

Check Disk for Errors

After formatting, verify the drive:

chkdsk F: /f

Replace F: with your drive letter.

Common Error Messages and Solutions

"Virtual Disk Service Error"

Solution: Restart Virtual Disk Service:

  1. Press Windows + R
  2. Type services.msc
  3. Find "Virtual Disk"
  4. Right-click and select "Restart"

"Access is Denied"

Solution: Ensure you're running CMD as Administrator

"Diskpart has encountered an error"

Solution: USB drive may be physically damaged. Try another USB port or computer.

Best Practices for USB Drive Maintenance

  • Safely eject: Always use "Safely Remove Hardware"
  • Regular formatting: Format every 6-12 months for optimal performance
  • Avoid frequent writes: Flash memory has limited write cycles
  • Keep backups: USB drives can fail without warning
  • Use quality brands: Cheap USB drives fail more frequently

Choosing the Right File System

File SystemMax File SizeCompatibilityBest For
NTFS16 TBWindows (Mac read-only)Windows-only drives, large files
FAT324 GBAll devicesMaximum compatibility
exFAT16 EBModern devicesCross-platform with large files

Video Tutorial Alternative

Prefer visual learning? Search YouTube for "Diskpart USB format tutorial" for video walkthroughs of this process.

Conclusion: You now have the complete knowledge to reset any USB drive to factory settings using Windows Diskpart utility. This method works for USB flash drives, external hard drives, and SD cards. Remember to always double-check the disk number before cleaning to avoid data loss on the wrong drive.

Amir H.

Amir H.

With over 15 years of experience, I am a dynamic digital content creator on YouTube, dedicated to crafting engaging content for a global audience. Over the past years, I have partnered with PUBG, regularly streaming live gameplay on my YouTube channel, which boasts 400k subscribers. Additionally, I serve as a professional web developer at Amilma Digital agency, where we have empowered numerous small, medium, and large enterprises to achieve their digital objectives. As a freelancer, I have collaborated with over 1,000 companies worldwide, leveraging my extensive skills in web development, graphic design, network administration and security, and video editing to deliver excellence in diverse and challenging projects. I also do some stuff for Google. I was honored as Influencer of the Year by SNL magazine in Bosnia and Herzegovina, receiving over 120k votes.

Leave a comment

Your email address will not be published. Required fields are marked *

Your experience on this site will be improved by allowing cookies Cookie Policy