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:
- Open Command Prompt as Administrator: Search for
cmd
in the Windows search bar, right-click on "Command Prompt," and select "Run as administrator." - Launch Diskpart: In the Command Prompt window, type
diskpart
and pressEnter
. This will open the Diskpart utility prompt (DISKPART>
). - List Available Disks: To identify the disk you want to clean, type
list disk
and pressEnter
. A list of all connected disks will be displayed with their size and disk number (e.g., Disk 0, Disk 1, etc.). - Select the Target Disk: Based on the list, identify the disk number you want to clean. Type
select disk X
(replaceX
with the actual disk number) and pressEnter
. Diskpart will confirm that the disk is now the selected disk. - Execute the
clean
Command: From the diskpart prompt, typeclean
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.
- Confirm Completion: Once the
clean
command is finished, Diskpart will return to theDISKPART>
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.