Syncios D-Savior: Recover All Deleted Files

Home > How to > PC Recovery >

How to Format a Disk / Hard Drive Using CMD in Windows

author By Ethan Mercer
Updated on: May 30, 2025
Category: PC Recovery

When Windows Explorer fails to format a stubborn drive or you need precise control over disk partitions, Command Prompt offers powerful solutions that GUI tools can't match. This comprehensive guide walks through the exact Diskpart commands to format everything from USB flash drives to system partitions. You'll learn not just how to format disks or drives using CMD, but how to troubleshoot common errors and - crucially - how to recover data from a formatted disk if things go wrong.

Format a Disk Using CMD in Windows

When & Why to Use CMD to Format a Disk

While Windows provides graphical formatting tools, Diskpart via CMD becomes essential when:


Backup Data Before Formatting Disk Using CMD (Crucial!)

⚠️ Critical Warning: Formatting permanently erases all data on the target drive. Countless users lose irreplaceable photos and documents by skipping this step. Before running any Diskpart commands:

  1. Copy important files to another drive or cloud storage
  2. Verify your backups are complete and accessible
  3. Physically disconnect backup drives before proceeding

Forgot to backup? If you've already formatted the drive without saving data, data recovery tools like Syncios D-Savior can often rescue files - but you must stop using the drive immediately. Every new file written reduces recovery chances.


How to Format a Disk Using CMD (Step-by-Step Guide)

Step 1 – Open Command Prompt as Administrator

Press and select "Command Prompt (Admin)" or "Terminal (Admin)" from the left sidebar. Click "Yes" on the pop-up prompt. If you do not have administrator privileges, you will get an "Access Denied" error when modifying the disk.

Opening a terminal window with administrator privileges

Step 2 – Launch DiskPart

Type diskpart and press .

You'll see the prompt change to DISKPART>. This powerful utility has been Windows' hidden formatting tool since Windows 2000.

Launching DiskPart disk management tool via CMD

Step 3 – List and Select the Disk

Type list disk and select disk 1.

list disk      # Shows all connected storage devices
select disk 1  # Replace 1 with your disk number

Disk numbering starts at 0. You should carefully review all disk sizes before making your selection to avoid accidentally selecting your primary system drive. Carefully identify your target disk.

Selecting a disk to operate on using CMD

Step 4 – Clean the Disk (Optional - Wipes Partitions)

Type clean.

This command will erase all partition information on your computer's disk. It is best used only when you are faced with repurposing a drive or removing stubborn partitions.

Warning: Using cmd to format the disk will make data recovery much more difficult than simple formatting.

Success message after formatting a disk via CMD

Step 5 – Create a New Primary Partition

Type create partition primary.

This will create a single partition using all available space, but for most users a primary partition is sufficient.

Creating a new partition using CMD

Step 6 – Format the Partition (Specify NTFS, FAT32, or exFAT)

Type format fs=ntfs quick.

Choose your file system based on usage:

format fs=ntfs quick    # Best for Windows internal drives
format fs=fat32 quick  # Compatible with most devices (max 32GB)
format fs=exfat quick  # For large USB drives & external storage

Generally speaking, format fs=ntfs quick only takes a few seconds to complete, and the data can still be recovered. But if you remove quick and enter format fs=ntfs, it means you need to perform a full format and check for bad sectors.

Accidentally formatted? If you used quick or full format, you need professional data recovery solutions provided by Syncios D-Savior to have a free scan your formatted disk ASAP.

Formatting a specific partition via CMDy

Step 7 – Assign a Drive Letter

Type assign letter=G.

assign letter=G  # Use any available letter
exit            # Exit Diskpart
exit            # Close Command Prompt

Without assigning a drive letter, your newly formatted drive won't appear in File Explorer. This final step makes it accessible.

Assigning a drive letter to a partition using CMD


CMD Format Examples for Different Use Cases

Formatting a USB Drive via CMD (FAT32/exFAT)

When Windows fails to format a USB drive, use these Diskpart commands:

select disk 1           # Replace 1 with USB disk number
clean
create partition primary
format fs=exfat quick    # For drives larger than 32GB
assign

This will help you get around the 32GB FAT32 limitation in Windows Explorer. This method is useful for formatting large flash drives.

Format C: Drive via CMD (Boot Media Required)

Formatting a system drive requires a few special steps compared to other hard drives:

  1. Create Windows Installation Media on USB
  2. Boot from USB and press Shift+F10 during the installation
  3. Use Diskpart to select and format the OS partition

⚠️ You must understand that this will erase your entire Windows installation! It is best to have recovery media ready before proceeding. After formatting, you will need to reinstall Windows.

Formatting an External Hard Drive via CMD

For external drives, I recommend NTFS for better performance:

select disk 2          # Replace 2 with your disk number
clean
create partition primary
format fs=ntfs quick    # NTFS handles large files better
assign

How to Recover Deleted Files from Formatted Disk

After accidentally formatting a drive with important files, you should immediately stop using the drive - continued use overwrites recoverable data.

Even if you haven't experienced accidental deletion yet, consider installing Syncios D-Savior on your computer now as a precaution. Should you ever face a file emergency, you'll be able to run a free, thorough scan of your entire disk during that critical recovery window. This tool recovers nearly every type of file imaginable - documents, photos, videos, and more.

The best part? You don't need tech expertise. Unlike using command prompts or complex tools, Syncios interface keeps it simple: just select your target drive (internal or external) and click 'Scan Now'. You'll see all recoverable files organized by both folder structure and file type. Take advantage of the preview feature to verify items before initiating precise recovery - ensuring you only restore what you truly need.

Syncios D-Savior Syncios D-Savior
  • Recover data from a formatted disk, hard drive, SSD, lost partitions, emptied recycle bin, etc.
  • Recover data from an SD card, TF card, CF card, USB flash drive, other storage media.
  • Recover 1,000+ formats of images, videos, audio, folders, archives, documents, etc.
  • Save recovered data to any desired location, including external drives.
  • Provide detailed file preview prior to recovery.
  • Support recovering data while scanning.

Format a Disk: Common Errors and Fixes

Ran into trouble while formatting? These quick solutions handle most common issues:

❌ "Access is denied"

Quick fix: Right-click Command Prompt and select "Run as administrator"

❌ "The volume is in use"

Try this:

  1. Close any open files on the drive
  2. Type in Diskpart: select volume X (replace X with your number)
  3. Then type: dismount

❌ Drive not showing up

Check these first:

  • Is the USB cable properly connected?
  • Try a different USB port
  • In Diskpart, type: rescan
  • Restart your computer

❌ Virtual Disk Service error

Usually works:

  1. Type in Command Prompt: chkdsk /f X: (replace X with your drive letter)
  2. Temporarily turn off your antivirus software
  3. If still failing, the drive might be damaged

CMD Format vs GUI Tools: Which One Should You Use?

Not sure whether to use commands or clickable tools? Here's when each method makes sense in everyday situations:

Use Diskpart/CMD when:

Use Disk Management/File Explorer when:

Many technicians keep both methods ready - Diskpart for troubleshooting stubborn drives, and graphical tools for routine maintenance tasks where speed and simplicity matter most.


FAQ About Formatting a Disk Using CMD

Can I format C drive from CMD?

Yes, but only when booted from Windows installation media - you can't format the C: drive while Windows is running on it.

Is it safe to use DiskPart?

It's powerful but requires caution. Always double-check disk numbers before running commands to avoid wiping the wrong drive.

What is the difference between quick and full format?

Quick format takes seconds (files seem gone but might be recoverable). Full format takes hours but checks for drive problems.

How do I force wipe a disk?

Use clean all - it overwrites the entire drive with zeros, making recovery nearly impossible.

How to repair hard disk using CMD?

Use chkdsk /f /r X: to fix file errors, but it can't repair physical damage like clicking sounds or overheating.

What does Diskpart Clean All do?

Performs a military-grade wipe by writing zeros to every sector - great for sensitive data but takes hours for large drives.

Important recovery note: If you disk or drive is formatted with all data loss, tools like Syncios D-Savior can recover 1000+ types of files before permanent loss occurs. - but stop using the drive immediately for best results.

Final Thoughts

At first, typing in commands may seem strange to you, but it can repair, format disks, hard drives, and more control than regular Windows tools can. But be careful, because even experts can be careless sometimes, so always keep backups and know how to recover files. It doesn't take much time to install Syncios D-Savior, but it's better to be prepared when you need to recover disappeared files from your computer or 2000+ external storage media. It can provide free scans in a very timely manner to help you at prime time.


What's next? Download Syncios D-Savior now!
Author Avatar

Ethan Mercer | Senior Writer

Tech writer with over a decade of experience, Ethan Mercer focuses on computing, mobile technology, and data solutions, offering deep insights into how these technologies shape our daily digital interactions.