Users encounter situations when it is necessary to format a disk through the Windows command line, for example, if for some reason formatting a hard disk in another way failed.
In this case, the user has the option to format the hard drive through the command line in the Windows operating system. Using the command line, depending on the situation, you can format the entire hard drive or one of the partitions (volumes) on the hard drive.
If the computer has one partition: “Logical disk (C:)”, which contains the Windows operating system and user data, it is impossible to format the disk in a running system, because this disk is currently used for system operation. In this guide, we will analyze how to proceed in this situation.
Disk formatting is carried out in some situations:
- when installing an operating system on a disk;
- in case of virus infection, PC malfunctions;
- when using a new hard drive;
- to delete unnecessary data.
In this article, we will look at several ways to format a hard drive through the command line, the instructions provide examples for various situations that users encounter. These methods work on Windows 10, Windows 8.1, Windows 8, Windows 7 operating systems.
How to format a drive through the command line using the format command
The Command Prompt (CMD) tool has a “format” command that formats a drive to a specified file system. In a running operating system, using this command, you can format partitions on a disk that do not have Windows installed.
If there are several partitions on the hard disk (the system is located on the “C” drive), for example, disks “D” and “E” that need to be formatted, then using the “format” command, the disk “D” is formatted first, and then the disk “E”. If another optional hard drive is connected to the computer, this drive can be completely formatted because it does not have an operating system.
1 option. We format the disk through the Windows command line (standard option):
- Run command prompt as administrator.
- Enter the command to format the drive:
format d: /FS:NTFS
- Enter the volume label for the disk to be formatted.
- Next, you need to press the “Y” key to agree with the conditions for formatting the disk, and then press the “Enter” key. You are warned that all data on the disk will be destroyed.
This will start the disk formatting process.
Option 2. If you add additional switches to the “format” command, you can customize the formatting options.
- Run command prompt as administrator.
- In the command line interpreter window, run the command:
format d: /FS:NTFS /x /q
With a quick format, Windows marks all disk space as unused. The data remains on the disk, the operating system does not see it, new files are gradually written to this place. A normal, full format deletes all data on the drive, but this process takes much longer than a quick format.
- To start formatting, press the “Y” key.
After the process is completed, information about the completion of this operation will appear in the command line window.
We considered the option of formatting individual partitions of a hard disk, or another hard disk on which Windows is not installed, on the command line.
Using the DiskPart Utility
The Diskpart utility is designed to work with disks, the application performs the following operations: creating a new disk (volume), deleting an existing disk, creating a bootable USB flash drive , formatting a disk partition or the entire hard disk.
The program can be used on a running Windows operating system, but for simple formatting it is much easier to use the “format” command. We will consider two options for using DiskPart: formatting a hard disk partition, or formatting a hard disk system partition, the entire hard disk, if we have only one partition on it.
Due to the fact that we will not be able to format the system disk in a running Windows, we will use bootable media from which we will launch the command line. To do this, we need bootable media from which we can boot on the computer, and then run the command line: bootable Windows USB flash drive, Windows Recovery Disc, Windows installation DVD, Windows PE flash drive or disc, Live CD (Live CD, Live DVD, Live USB).
You need to boot on your computer from a USB flash drive or CD / DVD, depending on which media you are using. First, enter the BIOS or UEFI boot menu, select a boot device, and then, after booting from the media, in the Windows RE recovery environment, launch a command prompt.
How to format a disk via command line using Diskpart – 1 way
To format a separate non-system partition or hard drive, you can work from Windows or from bootable media.
In the command line interpreter window, you must execute sequential commands (after entering the command, press the “Enter” key):
- Launching the DiskPart utility.
- Enter a command to list all disks (volumes) on the computer.
On this computer it is “Volume 3”. You need to select your drive number to be formatted.
- Select a volume letter (you will have your own number).
select volume 3
- Start formatting in the “NTFS” file system, if necessary, you can select the “FAT32” file system.
format fs=ntfs quick
- Run the command to exit the DiskPart application.
Formatting a disk through the command line in Diskpart – 2 way
If you needed to format the entire system disk with all partitions, you need to boot to your PC from bootable media.
In the Windows RE recovery environment, enter the command prompt, and then run the following commands in sequence:
diskpart list volume
select volume 2
create partition primary format fs=ntfs quick exit
If necessary, the user can format the drive through the command line. Using the “format” command at the command line, format a single hard disk volume or hard disk if it is an additional non-system hard disk. Using the DiskPart program, you can format an individual partition or the entire hard drive.
To do this, you will need to boot on the computer from bootable media with the Windows RE recovery environment, from where you need to launch the command line, and then perform the necessary actions.