How to use Diskpart for managing hard disk partitions

When we talk about getting the most out of our equipment, they come to mind as optimization or overclocking of processor, graphics or RAM. We rarely think about optimizing and getting the most out of our storage units. But today we are going to explain how to use diskpart, a very complete tool that is used from the Windows 10 command terminal.
No products found.
Table of Contents
What is Diskpart
It is a tool that is executed by means of commands that allows us fully manage our hard drives. We could use many different tools with graphical environment on Windows, but Diskpart is more powerful and offers us more options. Something very interesting to keep in mind is that this tool It exists from Windows XP to Windows 10. Its use is simple and can be used both through 'Symbol of the system'as with'Windows PowerShell'.
One of Diskpart's strengths is that You can see hard drives that the Windows GUI does not display. In addition, this function allows you to create or delete partitions, change the size of partitions, format hard drives, etc. In addition, it has the ability to show failed hard drives or RAW drives, allowing an attempt to recover them.
Diskpart is characterized by be available on DVD and USB installation of the operating system. This also allows it to be used via Command Prompt within recovery mode. As we can see, it is a tool that is important to know.
How to use Diskpart and start using it
Accessing this tool is relatively straightforward, as it can be accessed via Command Prompt or Windows PowerShell. We must bear in mind that for how to use Diskpart we need administrator permissions. We go with the steps to use the tool.
- How to use Diskpart using PowerShell: We click the right button on the start menu and a series of options will appear. We can find the option 'Windows PowerShell (Administrator)', which is the one that interests us.

- How to use Diskpart via Command Prompt: We can access it through the conventional Windows command terminal. It is as simple as opening the start menu and typing 'CMD' (or using the search engine on the Windows 10 taskbar). Once it appears, right click and this is important: 'Run as administrator'

We can use PowerShell or Command Prompt interchangeably, since both allow us to do the same tasks. We must write the following command and after this we press 'Enter':
diskpart
After entering this command the terminal promt will change and show us 'DISKPART>'. This tells us that we are inside the tool and that we can start using it.
Diskpart options
Once in here, we need to know what things we can do with the Diskpart tool. If you don't know what options it offers, you can run the 'HELP' command at the promt and hit 'Enter'. But don't worry, we are going to tell you which are the most important for our case.
help
These are the most interesting options for us:
[tie_list type=»starlist»]
- SELECT: Select a volume or disk. We must enter 'select partition or 'select disk '
- LIST: It shows us a list of objects, either partitions or hard drives
- DETAILS: Provides a detailed list of a partition or hard drive
- ACTIVE: We mark the selected partition as active
- ASSIGN: Allows you to assign a drive letter or mount point to the created volume
- Attribute: We can modify the attributes of the volume
- CLEAN: Clears the configuration information and information of the selected hard drive [USE WITH GREAT CARE]
- CONVERT: Convert between various disc formats. Typically used to convert a hard drive to dynamic or basic
- CREATE: Simple command to create partitions or virtual drives
- DELETE: Delete any of the previous cases
- EXTEND: Extend (increase the size) a partition
- FILE SYSTEMS: Shows us the current file system and that they are compatible with this volume
- RECOVER: Update the status of the selected disks. You try to recover the disks from the invalid package and resynchronize the mirrored volumes. It also works for RAID5 systems with parity.
- FORMAT: Format a volume or partition
- Removal: We remove the drive letter and assign it a mount point
- EXIT: We close Diskpart
[/ tie_list]
List and select objects with Diskpart
Now we have the most important commands in the use of Diskpart, so we can go with the first steps. The first thing we have to do is know which hard drives and partitions we have and which one we want to select. Diskpart is based on the drives, volumes and partitions we have so we need a list of these.
Disc list
If we want to see a list of hard drives in our system we must enter this command:
list disk
A list with several columns with all the information appears on the screen. The first shows us the disk number that the system has assigned to it, something important for the unit selection process. It also shows us the size of the hard drive and if it is a GPT drive.
[box type=»info» align=»» class=»» width=»»]GPT is simply a partition table implemented for EFI (Extensible Firmware Interface) systems that replaces the traditional MBR system found in older BIOSes. GPT is designed for UEFI systems[/box]
To select a unit we have to add the following command:
select disk
If we want to select 'Disk 1' we have to write 'select disk 1'
Once the disk is selected we can make a call to see more information about the unit:
detail disk
This allows us to see the type of storage unit it is, the partitions it has (if it has), and the file format. It also offers other additional data in case the unit has special characteristics.
Partitions
Diskpart also allows us to see all the partitions of a selected hard disk drive. For this we use the following command:
list partition
After executing this command, one of the partitions will appear with an asterisk (*) indicating the one that is selected. The actions that we carry out, therefore, will be carried out on the selected partition. To select one we must enter the following command:
list partition
If we want to select 'Partition 1' we have to write 'select partition 1'
If we want to know more information about the partition, we use the following command:
detail partition
We can also see what file system this unit supports, using this command:
fylesystems
Volumes
We have seen the disk drives and partitions separately, now we are going to see them together. We can work the same as in the previous cases, viewing the volumes, listing them and selecting the one that interests us. For this we have the commands:
list volume
select volume
This command is especially interesting to see which drives or partitions do not have a letter assigned. Let us see the actual number of drives in the system and partitions. OEM computers have a recovery partition that is not assigned a letter so that the file explorer does not show it. This system allows you to see them.
Now we can choose a partition or a drive by selecting a volume. This is the same thing that we have seen so far and it is done with these commands:
select volume
select partition
Create a partition with Diskpart
For this step we must take into account several aspects. The first is that this is intended for new drives that are empty, if the drive has data, take backups. We must also be very clear about the unit with which we are going to work. We are going to do it with a simple USB memory.
The first step, as it cannot be otherwise, is to select the storage unit to work on. The next step is to delete everything, leave it empty of data and formats. For this we use the command:
clean
Then we create a partition with the size that interests us specifying the amount in MB. For this first partition we use:
size =
Now we create the second partition with the rest of the available space. We use this command:
create partition primary
Now it's time to see all the available partitions:
list partition
The next step is to assign each of the partitions a name, a letter and a format, so that we can use it from the file explorer. For that we will use these commands:
select partition
format fs = NTFS label = ""quick
[box type=»info» align=»» class=»» width=»»]The usual format for Windows is NTFS, although we can also choose FAT32 and EXFAT, depending on the needs.[/box]
The next step is to activate the partition with this command:
active
Finally we assign a letter so that the system recognizes it. We can assign any of the letters that are available in our system. We use this command:
assign letter = "letter"
Once the letter has been assigned, a folder window of the created volume will open. We will do the formatting, activation and letter steps for each of the two partitions.
Erase partition with Diskpart
Those who already have partitions but want to create a drive from scratch with new partitions, can choose to erase the existing ones. The simplest and fastest solution to erase partitions and data is to use this command:
clean
After this, if we ask it to show us the partitions, it will tell us that "There are no partitions on this disk to show."
Format a partition with Diskpart
It may be that we already have partitions and we are not interested in deleting them, just format one of them. We may have a partition filled with data that is no longer valid and we want to clean it. The quickest and easiest way is to just format it. For this we select the partition.
list partition
select partition
Once we have the unit selected, we enter the following command:
format fs = NTFS lable = ""quick
[box type=»info» align=»» class=»» width=»»]The usual format for Windows is NTFS, although we can also choose FAT32 and EXFAT, depending on the needs.[/box]
If we have doubts we can use the command:
helpformat
Extended partitions with Diskpart
Another way to use Diskpart is to extend partitions. We may have a drive with two partitions, one full to the brim and the other almost unused. We can easily expand the capacity of the partition that we have full without the need to format. This step has certain limitations that we must consider:
[tie_list type=»lightbulb»]
- Extending a partition requires that the storage drive have available space. Otherwise we should format a partition
- To extend we need the unallocated space to be on the right of the partition to be extended, otherwise it will be impossible to do so
- Allocated space is not displayed in the command. It requires us to know the disk capacity and the amount of free space
- ONLY for NTFS partitions
- If we erase a partition to allocate more space, the data on the erased partition will be lost
- Extended partition will not lose stored data
[/ tie_list]
The first thing we must do is select the partition we want:
list partition
select partition
If there is no relevant data in the second partition and we want to delete it, we select it and enter the command:
delete
To extend a partition if there is room (or if we have made room for it) we must use the command:
extend size =
Now the unit will have gained in capacity in the amount that we have indicated in MB.
In case we have deleted the second partition, we can use this command:
extend
Basically all the remaining capacity is allocated to the selected partition.
Conclusion
These are some of the functions that the Diskpart tool allows. We will be adding more tutorials on how to use Diskpart and everything it allows us to do, which are not a few things.









