diskpart
The diskpart command interpreter helps you manage your computer’s drives (disks, partitions, volumes, or virtual hard disks).
Before you can use diskpart commands, you must first list, and then select an object to give it focus. After an object has focus, any disk part commands that you type will act on that object.Users can input DiskPart commands directly to organize hard disk partitions or create a text file script to perform multiple commands. Most disk partition operations that you can perform in Disk Management tool are integrated into DiskPart.
You can run the following commands from the Diskpart command interpreter:
Command | Description |
---|---|
active | Marks the disk’s partition with focus, as active. |
add | Mirrors the simple volume with focus to the specified disk. |
assign | Assigns a drive letter or mount point to the volume with focus. |
attach vdisk | Attaches (sometimes called mounts or surfaces) a virtual hard disk (VHD) so that it appears on the host computer as a local hard disk drive. |
attributes | Displays, sets, or clears the attributes of a disk or volume. |
automount | Enables or disables the automount feature. |
break | Breaks the mirrored volume with focus into two simple volumes. |
clean | Removes any and all partition or volume formatting from the disk with focus. |
compact vdisk | Reduces the physical size of a dynamically expanding virtual hard disk (VHD) file. |
convert | Converts file allocation table (FAT) and FAT32 volumes to the NTFS file system, leaving existing files and directories intact. |
create | Creates a partition on a disk, a volume on one or more disks, or a virtual hard disk (VHD). |
delete | Deletes a partition or a volume. |
detach vdisk | Stops the selected virtual hard disk (VHD) from appearing as a local hard disk drive on the host computer. |
detail | Displays information about the selected disk, partition, volume, or virtual hard disk (VHD). |
exit | Exits the diskpart command interpreter. |
expand vdisk | Expands a virtual hard disk (VHD) to the size that you specify. |
extend | Extends the volume or partition with focus, along with its file system, into free (unallocated) space on a disk. |
filesystems | Displays information about the current file system of the volume with focus and lists the file systems that are supported for formatting the volume. |
format | Formats a disk to accept files. |
gpt | Assigns the gpt attribute(s) to the partition with focus on basic GUID partition table (gpt) disks. |
help | Displays a list of the available commands or detailed help information on a specified command. |
import | Imports a foreign disk group into the disk group of the local computer. |
inactive | Marks the system partition or boot partition with focus as inactive on basic master boot record (MBR) disks. |
list | Displays a list of disks, of partitions in a disk, of volumes in a disk, or of virtual hard disks (VHDs). |
merge vdisk | Merges a differencing virtual hard disk (VHD) with its corresponding parent VHD. |
offline | Takes an online disk or volume to the offline state. |
online | Takes an offline disk or volume to the online state. |
recover | Refreshes the state of all disks in a disk group, attempt to recover disks in an invalid disk group, and resynchronizes mirrored volumes and RAID-5 volumes that have stale data. |
rem | Provides a way to add comments to a script. |
remove | Removes a drive letter or mount point from a volume. |
repair | Repairs the RAID-5 volume with focus by replacing the failed disk region with the specified dynamic disk. |
rescan | Locates new disks that may have been added to the computer. |
retain | Prepares an existing dynamic simple volume to be used as a boot or system volume. |
san | Displays or sets the storage area network (san) policy for the operating system. |
select | Shifts the focus to a disk, partition, volume, or virtual hard disk (VHD). |
set id | Changes the partition type field for the partition with focus. |
shrink | Reduces the size of the selected volume by the amount you specify. |
uniqueid | Displays or sets the GUID partition table (GPT) identifier or master boot record (MBR) signature for the disk with focus. |
How to open DiskPart in Windows 10/11?
You will need to launch Windows 10/11 DiskPart with Administrator permission.
Listing available objects
You can view a list of options associated to each command by running the main command followed by what is available to that specific command. Running list by itself will display the four parameters below:
Examples
To see available disk(s), run list disk:
list disk
To select a disk, run select disk followed by the disk number. For example:
select disk 0
Before disk 1 can be utilized, a partition will need to be created by running create partition primary:
create partition primary
Lastly, we can perform a quick format of disk 1 to NTFS with the label “Backup” by running format fs=ntfs label=Backup quick as seen below:
format fs=ntfs label=Backup quick
Learn how to prepare a USB flash drive for use with Windows Server Essentials by using DiskPart, a command-line utility. Follow the steps to delete, format, create and make drive as active.
How Do I Delete a Volume or Partition?
- Select Disk <no>
- List Volume
- Select Volume <no>
- Delete Volume
Post this; a confirmation message will show up that Diskpart has successfully deleted the volume. That said, you cannot delete System or Boot Volume.
How Do I Assign Drive Letter to a Hidden Partition?
If a partition can be seen in the Diskpart tool but is not available through the File Explorer, then it’s because there is no drive letter assigned to it.
- Select Disk <no>
- List Volume
- Select Volume <no>
- assign letter=<alphabet>
Make sure that the assigned alphabet is not already in use.
So, that’s all in this blog. I will meet you soon with next stuff. Have a nice day!!!
Guys please don’t forget to like and share the post. Also join our WindowsTechno Community and where you can post your queries/doubts and our experts will address them.
You can also share the feedback on below windows techno email id. If you have any questions feel free to contact us on admin@windowstechno.com also follow us on facebook@windowstechno to get updates about new blog posts.