Using DiskPart from a Windows 10 Bootable USB to Format or Wipe an Internal Drive


Windows 10 Setup Problems

The Windows 10 setup has the ability to "delete" partitions however in some cases it will struggle to recognize the file system when a Linux distribution has been installed or a different file system has been used for example when the Windows 10 installation media is setup for a UEFI BIOS with Secure Boot and the drive previously had a Windows installation setup for a Legacy Boot. i.e. the Drive is formatted as FAT32 and the Windows 10 Installation Media is setup for GPT or vice-versa

We couldn't create a new partition or locate an existing one. For more information, see the Setup log files

Creating a Windows 10 Bootable USB

To launch Diskpart from a Windows 10 Bootable USB you first need a Windows 10 Bootable USB. It is recommended to use the latest version of Windows 10 as it is most likely to have updated storage controllers inbuilt which may be required for diskpart to recognise your internal drives. For more details see:

Data Loss

Using Diskpart will proceed in data loss. Do not carry out this procedure if you have important data not backed up on your drive.

Booting from Windows 10 Installation Media

Power up your PC and press [F12] on a Dell or Lenovo:

To the top, for a Windows 10 install, the Boot Mode should be set to UEFI and Secure Boot should be On. If not select "Change Boot Mode Settings" to enable a UEFI Boot Mode with Secure Boot. For a Lenovo PC you may need to select Enter Setup and navigate to the Security Tab to ensure that Secure Boot is Enabled.

Select your Windows 10 Bootable USB it should display under a UEFI Boot.

The OEM logo will display:

The Windows logo should display:

Select your language, time and currency format and keyboard or input method and select Next:

Select Repair your Computer:

Select Troubleshoot:

Select Command Prompt:

To the top it will state X:\sources which means it is running from the Bootable USB which is asigned the drive letter X:\

Type in:


Diskpart will launch, you will see the version of your Windows 10 installation media:

Next type in:

list disk

A number of disks will display. You will have to judge what disk is what by using the file sizes. In this case Disk 0 is ~250 GB and is the internal SSD and Disk 1 is ~8 GB and is the Bootable USB.

Since my internal drive is disk 0, I will type in:

select disk 0

Amend the disk number if required.

The disk will be selected:

There are two commands which can now be used.

The command clean removes all partitions on the drive. Think of your drive as a field where your data is a set of crops enclosed by fences or partitions. When the partitions are removed all the crops remain in place. The space the crops occupied is designated as free space but the crops are still present. If no subsequent drive operations are carried out the crops or data can be recovered using third party utilities.


Because only the partitions are removed this is done very rapidly.

The next command is clean all. This command removes the partitions like clean does and then performs a data wipe. Returning to the field analogy it is equivalent of driving a mower along the field and removing all the crops.

Data is present in binary form, a series of 0s and 1s. Clean All replaces all data on the drive with 0s so this procedure is also known as zeroing the drive. Diskpart uses a rudimentary algorithm that goes along the drive from start to finish replacing each bit of data with a 0 as a result this will take a long time. This data wiping technique is optimal for hard drives which operate this way but not for solid state drives.

OEM Data Wiping Procedures

OEMs such as Dell and Lenovo have responded to the industrial demand for data wiping and have incorporated Data Wiping procedures within their UEFI BIOS Setups. These data wiping routines wipe data at the hardware level opposed to the software level. In the case of SSDs, the drive manufacture have incorporated the means of securely wiping a SSD by use of a voltage spike. This data wiping procedure is more through and in the case of a SSD less write intensive (prolonging the SSD life). For a SSD it is recommended to use the OEM Data Wiping procedure in preference to Diskpart Clean All.

For older models which don't include this utility, you can either use Clean All or a Parted Magic Bootable USB.

Dell Data Wipe

Power up your Dell and press [F2] to get to the UEFI BIOS Setup:

The UEFI BIOS setup will open:

Press the [↓] arrow key to get to maintenance:

Press [Enter] to expand the category:

Look for Data Wipe and highlight it.

If you do not you have an older Dell model and Data Wipe isn't supported. You can use a third party tools such as Parted Magic for these older models.

Check Wipe on Next Boot:

Select OK to perform the Data Wipe – this will clear the data from all internal storage devices:

To proceed you will need to select No at the dialogue which asks Do you want to cancel this operation:

Now to the bottom right, select Exit:

The UEFI BIOS splash screen will display:

You'll be taken to Dell Security Manager. Again it will ask you if you want to cancel, with the default setting set to cancel:

Use the [←] arrow to highlight Continue and press [Enter]

It will warn you one last time, with the default option being set to cancel:

Press the [→] arrow and highlight [Erase] and then press [Enter]:

It will now start to erase internal SATA devices:

For a system with a NVMe SSD or internal SATA SSD the Data Wipe should take a couple of minutes. For a system with a HDD as an internal drive the Wipe will be time-consuming (~1 hour) and take several hours.

You will be informed the Wipe is successful:

When it is done, it will tell you Data Wipe Completed Successfully. Press [OK]:

If you get an unsupported error message, Bitlocker may have been enabled and encrypted your drives. You may need to unlock the PSID in order to proceed, you will need to use Parted Magic to do this.

You will return to the Dell UEFI BIOS splash screen:

It should then have an error stating no Bootable Devices found, this is because your internal drives are blank. You'll need to clean install Windows 10 now:

Power down your Dell. Then begin the Windows Installation from the Bootable USB.

Lenovo Data Wipe

Power up your Lenovo and press [F1] to get to the UEFI BIOS Setup.

You will be on the main tab by default. Press [→] until you get to Security then press [↵]:

Select Hard Disk Password. Although Lenovo call these settings "Hard Disk" they also relate to Solid State Drive.

Press [↓] until you get to (Hard Disk) Drive Password and press [↵]:

In this screen look for Security Erase (HDD) Data. If you do not have this option, your system may be too old to support Data Wipe from the UEFI BIOS and you will have to use a third party utility lke Parted Magic instead.

Press [↓] until you get to Security Erase (HDD) Data.

Unfortunately the Lenovo Data Wipes requires one to setup a temporary Hard Drive Password.

Setting a Drive Password will lock the drive at the drive firmware level and there is some risk doing so. If you set a password and the password is forgotten you will never be able to use the drive again.

Press [↑] until you get to SM.2 Drive Password and press [↵].

You have the option to set a User only password or a User + Master Password.

The first is designed for a User Only in which case the user would have full admin access to perform a data wipe.

The latter is designed for a company with a large IT department. The IT department would have the Master password to unlock the device and to perform a data wipe.

Select [User] and press [↵].

Input a basic password in this case I will use the letter a:

Confirm the password:

Select [Continue]:

Press [F10] to save and Exit. Highlight [Yes] and press [↵]:

Your computer will restart:

You will be prompted for your password as your computer begins to reboot. If you have a master password set you can press [F1] to switch to the master user.

In this case, the user password a will be input.

As soon as the user password is input press [F1] to get to the UEFI BIOS Setup. You will be on the Main tab. Press [→] until you get to Security and press [↵]:

Press [↓] until you highlight (Hard) Disk Password and press [↵]:

Then press [↓] until you get to Security Erase (HDD) SSD Data and press [↵]:

Select Erase NVMe Slot 1 Data and press [↵]:

Highlight [Yes] at the confirmation dialog and press [↵]:

Input your User Password and press [↵].

If a user and a master password are set it may only ask for the master password, so you will need to know the master password.

The Secure Erase will be performed and the Drive password will be removed.

Select [Continue] and press [↵]:

It should then have an error stating no Operating System found, this is because your internal drives are blank. You'll need to clean install Windows 10 now:

Parted Magic