How to clean and repair drive with DiskPart on Windows 11

If the drive is acting up or slowing down the computer, it could be a data corruption problem, which is when DiskPart can help.

Windows 11 DiskPart repair drive
Windows 11 DiskPart repair drive

On Windows 11, you can use the Check Disk (chkdsk) tool to scan and repair logical errors on a drive, but if the Task Manager continues to show one hundred percent active time on a drive, you’re still unable to access it, or you notice other problems, it could be a data corruption problem that you can resolve with DiskPart.

DiskPart is a command-line tool that allows you to manage drives on your computer. Usually, you would use the tool to set up a storage device, but if you’re having problems, you can use it to clean and repair the drive. Of course, assuming you are dealing with a logical problem, not a hardware issue.

This guide will teach you the easy steps to use DiskPart to revive a secondary hard drive on Windows 11.

Important: The instructions outlined below will delete any data on the drive. It’s assumed you have previously created a backup of the data you may need again.

Clean and repair drive with DiskPart on Windows 11

To erase and repair a hard drive on Windows 11 with DiskPart, use these steps:

  1. Open Start on Windows 11.

  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.

  3. Type the following command to open Diskpart and press Enter:

    diskpart
  4. Type the following command to determine the drive to format and press Enter:

    list disk
  5. Type the following command to select the storage and press Enter:

    select disk 3

    In the command, replace “3” with the number of the flash drive you want to use.

  6. Type the following commands to delete everything from the hard drive with the problem and press Enter:

    clean

    Format drive commands

  7. Type the following command to create a primary partition and press Enter:

    create partition primary
  8. Type the following command to select the new partition and press Enter:

    select partition 1
  9. Type the following command to make the selected partition active and press Enter:

    active
  10. Type the following command to make the hard drive bootable and press Enter:

    format FS=NTFS quick
  11. Type the following command to assign a volume and a drive letter for the drive and press Enter:

    assign letter=X

    In the command, change “X” for any available letter you want to use.

  12. Type the following command to quit the tool and press Enter:

    exit

Once you complete the steps, the drive will be erased, formatted, and mounted with the specified drive letter fixing the errors you may have experienced in the past.

About the author

Mauro Huculak is a Windows expert and the Editor-in-Chief who started Pureinfotech in 2010 as an independent online publication. He is also been a Windows Central contributor for nearly a decade. Mauro has over 12 years of experience writing comprehensive guides and creating professional videos about Windows, software, and related technologies, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 20 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter), YouTube, LinkedIn and About.me.