DiskPart is a powerful command-line utility that manages disks, partitions, or volumes in your computer. It comes inbuilt with Windows and is highly useful for diagnosing and fixing issues with your storage devices, as well as managing them effectively.
This guide will provide an extensive list of DiskPart commands, along with examples of their usage, and discuss how you can use DiskPart to create a bootable USB, delete partitions, format a USB, and use the CHKDSK command in both Windows 10 and Windows 7.
Understanding DiskPart and its Commands
DiskPart allows you to manage your computer’s drives directly from the command prompt.
It’s more advanced than the Disk Management tool, providing capabilities like converting disks to dynamic or GPT, creating and managing partitions, and more.
Here are some common DiskPart commands:
list disk
: Displays all the disks on your computer.select disk
: Selects the disk you want to work with. For example,select disk 0
.list partition
: Lists all partitions on the selected disk.select partition
: Selects a partition to work with. For example,select partition 1
.clean
: Removes all partitions and data from the selected disk.create partition primary
: Creates a primary partition on the current disk.format fs=ntfs quick
: Formats the selected disk or partition with the NTFS file system.assign letter
: Assigns a drive letter to the selected partition. For example,assign letter=E
.
These commands are just the basics. DiskPart has an extensive list of commands available, which you can find by typing help
in DiskPart.
DiskPart in Action: Examples and Usage
Let’s look at a few examples of how to use DiskPart, including creating a bootable USB, deleting a partition, and formatting a USB.
Creating a Bootable USB with DiskPart
A bootable USB can be a lifesaver if you need to install or repair an operating system. Here’s how to create one with DiskPart:
- Plug in your USB drive.
- Open Command Prompt as an administrator and type
diskpart
. - Use
list disk
to find your USB drive. - Select it using
select disk #
, replacing # with your USB’s disk number. - Clean the USB drive with
clean
. - Create a primary partition with
create partition primary
. - Select the new partition with
select partition 1
. - Make the partition active with
active
. - Format the USB drive with
format fs=ntfs quick
. - Assign a drive letter with
assign letter=K
, replacing K with your preferred letter.
Deleting a Partition with DiskPart
If you want to delete a partition, follow these steps:
- Open DiskPart with administrator privileges.
- Use
list disk
andselect disk #
to choose the disk containing the partition you want to delete. - Use
list partition
andselect partition #
to select the partition you want to delete. - Delete the partition using
delete partition
.
Formatting a USB with DiskPart
If you need to format a USB drive, you can do so with DiskPart as follows:
- Open DiskPart with administrator privileges.
- Use
list disk
andselect disk #
to choose your USB drive. - Clean the drive using
clean
. - Create a new partition with
create partition primary
. - Format the partition with
format fs=ntfs quick
orformat fs=fat32 quick
, depending on your needs. - Assign a drive letter with
assign letter=K
, replacing K with your preferred letter.
DiskPart in Different Windows Versions: Windows 10 and Windows 7
DiskPart works similarly in both Windows 10 and Windows 7, and the commands above can be used in either operating system.
However, there may be some minor differences due to changes in the underlying operating systems. Always ensure to check the official Microsoft documentation for the specific DiskPart commands available in your Windows version.
Using CHKDSK with DiskPart
CHKDSK is a utility that checks your disk for errors. Although it’s not a DiskPart command, you can use it in conjunction with DiskPart to manage your drives. To use CHKDSK:
- Open Command Prompt with administrator privileges.
- Use DiskPart to select the disk or partition you want to check.
- Exit DiskPart by typing
exit
. - Run CHKDSK with the command
chkdsk /f X:
, replacing X with the drive letter you want to check.
Conclusion
DiskPart is a powerful tool for managing drives in Windows. Whether you’re creating a bootable USB, deleting a partition, or formatting a USB, DiskPart provides the commands you need.
Despite its command-line interface, it’s relatively straightforward to use with the right instructions. Whether you’re on Windows 10 or Windows 7, mastering DiskPart can give you greater control over your computer’s drives.
And remember, the help
command is always there in DiskPart to provide a quick overview of the commands at your disposal. While this guide offers a good starting point, there’s plenty more to learn about DiskPart.
For a full list of DiskPart commands and their descriptions, Microsoft provides official documentation that can be downloaded in PDF form. Use this guide and the official documentation to unleash the full power of DiskPart and take command of your drives.