How to Format Hard Drive from Command Prompt or DISKPART.

Last updated on December 28th, 2020

In this tutorial you ill find step by step instructions on how to format a hard drive in command prompt with the FORMAT command or the DISKPART tool. By formatting a hard drive, you will delete all the data it contains, so make sure that you already have a copy of the data it contains.

Advertisements

In all Windows versions, the classic and most common method to delete, create and format partitions or hard disks is by using the Disk Management tool. But, sometimes it is impossible to delete or format a partition or volume on a hard disk by using the Disk Management tool, because the hard disk is not recognized by Windows for a variety of reasons. (e.g. when the file system on the disk is corrupted or because the hard drive is in RAW format, etc.).

In this guide you 'll find detailed instructions on how to format or to securely wipe a hard drive (HDD or SSD), from the Command Prompt with the "Format" command, or by using the "DiskPart" command line tool, in Windows 10, 8 or 7 OS.  Keep in mind, that you can use the same instructions to format a hard disk, from the Windows Recovery Environment (WinRE)

How to Format a Drive from Command Prompt or DISKPART.

1. Open command prompt as administrator. To do that:

1. In the Search box type: cmd or command prompt
2. Right click on the command prompt (result) and select Run as Administrator.

command prompt administrator

2. Now, use one of the two following methods to format the drive:

Method 1. How to Format a HDD, SSD Drive in Command Prompt (CMD).

1. Find out the "Volume Label" of the drive that you want to format, by typing this command: *

  • vol X:

* Notes:
1.
Where "X" = the drive letter of the disk that you want to format.
2. Be very careful when selecting the hard drive to format.

e.g. If you want to format the drive D:, then type: vol D:

format-command

2. To format the hard drive (to erase the data it contains), give the following command and press Enter:

  • format X:

3. When asked to "enter the current volume label", type the volume label mentioned after typing the above command and press Enter.

Advertisements

e.g If the want to format the disk D:, with Volume Label "New Volume", then type these commands in order:

  • format D:
  • New Volume
  • Y

How to Format Hard Drive from Command Prompt

Other examples of the FORMAT command: 

  • To QUICK FORMAT a hard drive in command prompt, type: format X: /q

Quick Format Hard Drive from Command Prompt

  • To format a hard disk in a specific FILE SYSTEM in command prompt, type: format X: /FS:Filesystem *

* Note: In "Filesystem" you can specify one of the following file systems: FAT, FAT32, exFAT, NTFS or UDF. e.g.:

    • To format the disk D: in the  NTFS file system: format D: /fs:NTFS
    • To format the disk D: in the  FAT32 file system: format D: /fs:fat32
    • To format the disk D: in the  exFAT file system: format D: /fs:exFAT

Format Hard Drive FileSystem Command Prompt

  • To preform a LOW LEVEL FORMAT on a hard drive, in order to securely erase it by writing zeros on every sector, type: format X: /FS:Filesystem /p:n *

* Notes:
1.
Where "n" = The number of times that you want to write zeros in every sector. Keep in mind that the command takes very long time to complete, even for one pass of writing zeros.
2. By filling with zeros a drive (hard disk, USB, Memory card, etc.), you ensure that all it's stored data will be erased permanently and no one can retrieve the data from it in any way.

    • e.g. : To format the disk D: with the  NTFS file system and to write zeros in every sectors twice type: format D: /fs:NTFS /p:2

Low Level Format Hard Drive

Method 2. How to Format a Hard Disk using DISKPART.

To format a hard drive using the DISKPART utility:

1. In the administrative command prompt window, type:

  • diskpart

image

2. At DISKPART prompt, type:

  • list disk

3. From the listed disks, locate which one is the disk that you want to format. You can easily find out which disk is in the list from its size in GB (Gigabytes).

4. Then select the disk by typing: *

  • select disk DiskNumber

* Note: Where "DiskNumber" = The number assigned to the disk that you want to format.

e.g. At this example, we want to format the "Disk 1" (see screenshot below). So the command in this case is: select disk 1

How to Format Hard Drive from DISKPART

5. Now according, what you wish to do, give one of the following commands (and press Enter):

  • To delete all partitions and data on the drive, type: clean

diskpart-format

  • To completely erase all partitions (and the data), by writing zeros on every sector (low level format), type: clean all

* Notes:
1.
The "clean all" command takes very very long time to complete, so be patient. (For 1TB it takes about 5-6 hours).
2. By filling with zeros a drive (hard disk, USB, Memory card, etc.), you ensure that all it's stored data will be erased permanently and no one can retrieve the data from it in any way.

diskpart-low-level-format

6. When the "low level format" is complete, type the following command to create a partition on the disk:

  • create partition primary

7. Then format the newly created partition, with this command:

  •  format fs=ntfs quick

8. When the format is completed, assign a drive letter on the formatted partition, by giving this command:

  • assign

9. Finally, type exit to close the DiskPart tool and then close the command prompt window.

How to Format Hard Drive from Command Prompt or DISKPART

That's it! Let me know if this guide has helped you by leaving your comment about your experience. Please like and share this guide to help others.

If this article was useful for you, please consider supporting us by making a donation. Even $1 can a make a huge difference for us in our effort to continue to help others while keeping this site free: