Erase Disk using Diskpart Clean Command in Windows 10

    Erase Disk using Diskpart Clean Command in Windows 10

    How to Erase a Disk using Diskpart Clean Command in Windows 10
    Published by Category: Hardware & Drivers
    29 Oct 2017
    Designer Media Ltd

    Published by


    Brink's Avatar
    Administrator

    Posts: 25,285

    Show Printable Version 


    How to Erase a Disk using Diskpart Clean Command in Windows 10

    information   Information
    You can use the clean or clean all Diskpart command options to erase (wipe) a disk leaving it unallocated and not initialized.

    The clean command removes any and all partition or volume formatting from the disk with focus. On master boot record (MBR) disks, only the MBR partitioning information and hidden sector information are overwritten. On GUID partition table (GPT) disks, the GPT partitioning information, including the Protective MBR, is overwritten; there is no hidden sector information. The clean command will only mark the data on the disk as deleted, and will not zero (secure erase) the disk like the clean all command below.

    The clean all command performs the same action as the clean command above, but includes to specify that each and every sector on the disk is zeroed (secure erase), which completely deletes all data contained on the disk. This will make the data on the disk unrecoverable. It will take about an hour per 320 GB to finish running the "clean all" command on a disk.

    This tutorial will show you how to use the clean or clean all Diskpart commands to erase a disk in Windows 7, Windows 8, and Windows 10.

    You must be signed in as an administrator to "clean" or "clean all" a disk.

    warning   Warning
    Be sure you verify the correct disk number of the disk you want to erase from Disk Management (diskmgmt.msc) before doing the steps below.

    You do not want to erase the wrong disk, and lose data.


    EXAMPLE: Disk that is not initialized and unallocated after running "clean" or "clean all" command
    Name:  Disk_Management_unallocated_disk.jpg
Views: 1923
Size:  121.5 KB



    Here's How:

    1. Open either an elevated command prompt or a command prompt at boot for what you want to use.
    Note   Note
    You will not be able to run the clean or clean all command on the disk that Windows is installed on unless you do so in a command prompt at boot.


    2. Type the command below, and press Enter. (see screenshots below step 5)

    diskpart

    3. Type the command below, and press Enter.

    list disk

    4. Type the command below, and press Enter.

    select disk #

    Note   Note
    Substitute # in the command above with the actual disk number (ex: "3") of the disk you want to clean.

    For example: select disk 3


    5. Type the command below you want to use, and press Enter.
    Note   Note
    The clean command will finish quickly since it only marks the data on the disk as deleted.

    The clean all command will take about an hour per 320 GB to finish running since it performs a secure erase.


    clean

    OR

    clean all

    Name:  diskpart_clean_command.png
Views: 1985
Size:  28.3 KB Name:  diskpart_clean-all_command.png
Views: 2004
Size:  37.8 KB


    6. You can now initialize the disk, convert the disk to MBR or GPT, and create a New Simple Volume on the disk. (see screenshots below)

    Name:  Disk_Management-Initialize_Disk.jpg
Views: 1923
Size:  96.3 KB Name:  Disk_Management-New_Simple_Volume.jpg
Views: 1923
Size:  107.9 KB


    That's it,
    Shawn


  1.    31 May 2017 #1
    Join Date : Dec 2015
    Posts : 6,000
    Windows10

    Wow - I learnt something new here - the clean all command.

    So boot from an installation drive, press shift+f10, select OS drive in diskpart and use clean all if selling PC - so who needs DBAN!
      My ComputerSystem Spec
  2.    31 May 2017 #2
    Join Date : Oct 2013
    Posts : 25,285
    64-bit Windows 10 Pro build 17046
    Thread Starter

    Correct. That will wipe the OS drive completely.
      My ComputersSystem Spec
  3.    01 Jun 2017 #3
    Join Date : Dec 2015
    Posts : 6,000
    Windows10

    Quote Originally Posted by Brink View Post
    Correct. That will wipe the OS drive completely.
    Might just be worth adding a sentence how to get to diskpart from an installation drive or similar.

    Actually a mini iso that just booted to the command prompt would be a really handy tool but never seen one.
      My ComputerSystem Spec
  4.    01 Jun 2017 #4
    Join Date : Oct 2013
    Posts : 25,285
    64-bit Windows 10 Pro build 17046
    Thread Starter

    I have a link in step 1 for how to open a command prompt at boot to help.
      My ComputersSystem Spec
  5.    13 Jul 2017 #5
    Join Date : Jul 2016
    Posts : 31
    Windows 10 Pro 64-bit

    Hello,

    I wan to re-install Win10 on a SSD, but want to do a clean-all command from diskpart first (virus issues). However, upon trying to do a secure erase first in Command Prompt (admin) - diskpart - selected disk - clean all, I got an error: "Clean all is not allowed on the disk containing the current boot, system, pagefile, crashdump, or hibernation volume."

    There's only Disk 0 as an option, I assume the error is because I can't do a clean wipe of the disk/OS I'm currently using?

    I have Win10 USB ready. Can I do a diskpart at start-up from the installation USB? Or is there another method to completely wipe the SSD before re-installing? Thank you
      My ComputerSystem Spec
  6.    13 Jul 2017 #6
    Join Date : Oct 2013
    Posts : 25,285
    64-bit Windows 10 Pro build 17046
    Thread Starter

    Hello scop8,

    You should be able to run the "clean all" command from a command prompt at boot when opened after booting from Windows 10 installation media.
      My ComputersSystem Spec
  7.    13 Jul 2017 #7
    Join Date : Jul 2016
    Posts : 31
    Windows 10 Pro 64-bit

    I'll give it a shot, thanks Brink
      My ComputerSystem Spec
  8.    13 Jul 2017 #8
    Join Date : Oct 2013
    Posts : 25,285
    64-bit Windows 10 Pro build 17046
    Thread Starter

    Please let us know how it went.
      My ComputersSystem Spec

 


Similar Threads
Tutorial Category
Displaying the disk free space with Diskpart
Hi Starting the command prompt from the Windows 10 v1703 DVD, how do I display the disk free space to create other partitions using Diskpart utility? Thanks Bye
Drivers and Hardware
W10 Diskpart/disk list
Hi to all and thank you to Spunk and Navy LCDR - Issue almost resolved from your help. I have just installed, in my notebook an old SSD EVO 850 Samsung as a 'second' separate SSD to use for a back-up. When I try to use Diskpart to clean this...
Drivers and Hardware
Can I erase all these portions in my clean install?
Upgraded my Win 7 Ultimate x64 to Win 10. Now when I went to perform a clean install of the Win 10 with USB created from Microsoft Media, take me through to the screen to partitions. There are three partitions, one marked as OEM. What could be...
Installation and Upgrade
Solved Can I erase all these portions in my clean install?
Upgraded my Win 7 Ultimate x64 to Win 10. Now when I went to perform a clean install of the Win 10 with USB created from Microsoft Media, take me through to the screen to partitions. There are three partitions, one marked as OEM. What could be...
Installation and Upgrade
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 06:25.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums