askvity

How Do You Use Clean in Diskpart?

Published in Disk Management 4 mins read

Using the clean command in Diskpart is a straightforward process for quickly erasing all partitioning information and data from a selected disk.

What is the clean Command?

The clean command is a powerful utility within the Windows Diskpart command-line tool. Its primary function is to zero out the first megabyte of the disk, effectively removing any partition structures, volume information, and the disk signature. This makes the disk appear as if it were never initialized or partitioned, ready for a fresh setup.

Warning: Using the clean command will permanently erase all data and partition information on the selected disk. Ensure you have selected the correct disk before proceeding.

Steps to Use clean in Diskpart

To utilize the clean command, you must first open Diskpart and then select the disk you wish to clean.

Here are the steps:

  1. Open Command Prompt as Administrator: Search for cmd in the Windows search bar, right-click on "Command Prompt," and select "Run as administrator."
  2. Launch Diskpart: In the Command Prompt window, type diskpart and press Enter. This will open the Diskpart utility prompt (DISKPART>).
  3. List Available Disks: To identify the disk you want to clean, type list disk and press Enter. A list of all connected disks will be displayed with their size and disk number (e.g., Disk 0, Disk 1, etc.).
  4. Select the Target Disk: Based on the list, identify the disk number you want to clean. Type select disk X (replace X with the actual disk number) and press Enter. Diskpart will confirm that the disk is now the selected disk.
  5. Execute the clean Command: From the diskpart prompt, type clean and press Enter. This command initiates the cleaning process on the selected disk.
  • Reference Information: According to the documentation, From the diskpart prompt, type clean and press Enter. The drive's partition, data, and signature is now removed. You will return to the diskpart prompt.
  • Important: Warning: Once you type clean and hit enter the drive will be erased.
  1. Confirm Completion: Once the clean command is finished, Diskpart will return to the DISKPART> prompt. There is usually no detailed success message other than returning to the prompt.

After Cleaning

After successfully using the clean command, the disk will be unallocated space. You will need to initialize, partition, and format the disk before you can use it again in File Explorer.

This involves further Diskpart commands such as:

  • create partition primary
  • format fs=ntfs quick
  • assign letter=Y (replace Y with a desired drive letter)

Alternatively, you can use Windows Disk Management (diskmgmt.msc) which provides a graphical interface to initialize, partition, and format the cleaned disk.

Summary of Key Commands

Command Description Purpose
diskpart Starts the Diskpart utility Access the command-line disk management tool
list disk Shows all connected disks Identify the target disk number
select disk X Selects disk number X for subsequent commands Specify which disk to perform actions on
clean Erases partition and volume information (MBR/GPT) Prepare a disk for fresh partitioning/initialization

Using clean is an effective way to prepare a disk for repurposing or resolving certain disk issues related to partitioning.

Related Articles