Erase Disk using Diskpart Clean Command in Windows 10  

Page 1 of 7 123 ... LastLast
    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
    03 Jul 2020
    Designer Media Ltd

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


    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.


    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
    Erase Disk using Diskpart Clean Command in Windows 10-disk_management_unallocated_disk.jpg



    Here's How:

    1 Open either an elevated command prompt or a command prompt at boot for what you want to use.

    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 diskpart command into the command prompt, and press Enter. (see screenshots below step 5)

    3 Type the list disk command into the command prompt, and press Enter.

    4 Type the command below into the command prompt, and press Enter.

    select disk #

    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 clean or clean all command you want to use into the command prompt, and press Enter.

    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.

    Erase Disk using Diskpart Clean Command in Windows 10-diskpart_clean_command.png Erase Disk using Diskpart Clean Command in Windows 10-diskpart_clean-all_command.png


    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)

    Erase Disk using Diskpart Clean Command in Windows 10-disk_management-initialize_disk.jpg Erase Disk using Diskpart Clean Command in Windows 10-disk_management-new_simple_volume.jpg


    That's it,
    Shawn






  1. Posts : 15,485
    Windows10
       #1

    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 Computer


  2. Posts : 68,937
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #2

    Correct. That will wipe the OS drive completely.
      My Computers


  3. Posts : 15,485
    Windows10
       #3

    Brink said:
    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 Computer


  4. Posts : 68,937
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #4

    I have a link in step 1 for how to open a command prompt at boot to help.
      My Computers


  5. Posts : 32
    Windows 10 Pro 64-bit
       #5

    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 Computer


  6. Posts : 68,937
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #6

    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 Computers


  7. Posts : 32
    Windows 10 Pro 64-bit
       #7

    I'll give it a shot, thanks Brink :)
      My Computer


  8. Posts : 68,937
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #8

    Please let us know how it went. :)
      My Computers


  9. Posts : 314
    Windows 10 Pro x64 Build 1803
       #9

    Hey Brink again!

    Is this normal for it to repeat itself like shown in this image? Because I don't seem to see any mention of that?

    Erase Disk using Diskpart Clean Command in Windows 10-diskpart.jpg
      My Computer


 

Tutorial Categories

Erase Disk using Diskpart Clean Command in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
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 22:50.
Find Us




Windows 10 Forums