- Diskpart allows you to manage disks, partitions and volumes in Windows with professional precision.
- It offers advanced features beyond the graphical interface options, including scripting and automation.
- Its use requires caution, always with administrator permissions and prior backup.

The command Diskpart It is, without a doubt, one of the most powerful and versatile tools included in the OS Windows for managing hard drives, partitions, volumes and storage devices storage In general, although there is an easy-to-use graphical interface for performing some basic tasks, many advanced users, technicians, and even computer enthusiasts prefer to use Diskpart due to the enormous control and precision it offers. Launched in 2000 to replace the old 'fdisk', Diskpart has evolved to adapt to modern needs, even allowing manipulation of virtual hard drives (VHDs), operations with GPT partitions, and MBR, and managing both internal and external disks, memories USB and SD cards.
In this article we are going to tell you absolutely Everything you need to know about Diskpart. From the most basic notions to the commands advanced, including practical examples and essential tips so you can get the most out of it without risks and, above all, avoiding data loss due to execution errors. If you want to learn how to clean a hard drive, forma tear partitions, convert partition types, create dynamic volumes, or manage disks in Windows Server like a pro, keep reading. Here's the definitive, comprehensive, perfectly organized, and up-to-date guide.
What is Diskpart and what is it used for?
Diskpart It is a command-line utility developed by Microsoft that allows you to manage disks, partitions, and volumes on Windows systems (XP, Vista, 7, 8, 8.1, 10, 11, and server versions). Its main advantage is that it provides great flexibility and control about him hardware Storage. It includes features not available in the graphical disk management interface, such as direct manipulation of certain attributes, creating or deleting dynamic volumes, changing advanced partition types, or running automated scripts for repetitive actions.
It is compatible with desktop computers, portable, servers, and even removable storage devices. It's especially suitable for advanced users, system administrators, and technicians, but it's accessible to anyone with minimal knowledge if they follow the guidelines and precautions we'll cover later.
How to access Diskpart in Windows
There are several ways to start Diskpart, depending on your version of Windows:
- From the start menu: Press the keys Windows + S and type 'diskpart', then right click and select 'Run as administrator'.
- From the Run window: Press Windows + R, type cmd and press Enter. Then type diskpart and hit Enter.
- On Windows Server and later versions: You can access from Windows PowerShell executed as administrator.
- From a Windows installation or recovery environment: Accesses symbol of the system and runs 'diskpart' even when the system does not boot normally.
When you run Diskpart successfully, you will see the prompt change to DISKPART>, indicating that it is ready to receive specific commands.
Basic concepts you should master
To use Diskpart safely, you need to understand the key concepts:
- Disk: It is the physical storage device (HDD, SSD, external USB, etc.).
- Partition: It is a portion of a physical disk's space that can contain one or more volumes. They can be primary, extended, or logical, depending on the chosen partitioning scheme (MBR, GPT).
- Volume: It is the logical entity on which a file system is mounted. In general, each partition is usually equivalent to a volume, although on dynamic disks, volumes can span multiple partitions or disks.
List of the most important commands and what each one does
Diskpart It has an incredibly wide repertoire of commands. The most commonly used ones include:
- list disk: Displays all physical disks connected to the system.
- select disk : Select the disk you are going to work on (replace X with the number obtained in list disk).
- list partition: Lists all existing partitions on the selected disk.
- select partition : Mark a specific partition as a target for future operations.
- list volume: Displays all available volumes.
- select volume : Select a specific volume by number or letter.
- create partition primary/logical/extended size=: Creates a new partition of the specified type and size.
- Delete Partition: Deletes the selected partition.
- format fs= label= quick: Formats the selected volume, choosing a file system and optionally a label and quick format.
- assign letter=: Assign a drive letter to the partition/volume so that it appears in File Explorer.
- remove letter=: Removes the drive letter from a volume, useful for hiding the drive from the user.
- clean: Erases all partitions and data on the selected disk. Use this command with extreme caution!
- extend size =: Extends the selected volume with available contiguous unallocated space.
- shrink desired=: Reduces the size of the selected volume (only available for NTFS).
- convert mbr/gpt/dynamic/basic: Converts the partitioning scheme of the selected disk.
- active: Marks a partition as active, which is required for it to be Boot.
- help: Displays help on any command.
- detail disk/volume/partition: Displays detailed information about the selected item.
- exit: Close Diskpart and return to the normal command prompt.
- attributes disk/volume: Manage attributes such as read-only, hidden, etc.
- filesystems: Lists the file systems supported by the selected volume.
Recommended order of use: Typical operation with Diskpart
The basic workflow for any Diskpart operation typically follows these steps:
- List available discs:
list disk - Select the target disk:
select disk X(replace X with the desired disk number) - List existing partitions:
list partition - Select partition:
select partition N(optional, if you are going to operate on a specific partition) - Choose or create a volume:
create partition primary/logical/etc. - Format the partition:
format fs=ntfs label="Nombre" quick - Assign letter:
assign letter=F - Check that everything is correct:
list volume,detail disk, etc.
Practical examples of using Diskpart
Example 1: Clean a disk and create a new partition
- Open Diskpart as administrator.
- list disk – find out the number of the disk you want to clean.
- select disk 1 – for example, disk 1.
- clean – deletes all partitions and leaves the disk empty.
- create partition primary size=102400 – create a 100GB partition.
- Select Partition 1
- format fs=ntfs label=»Work» quick – quick formatting and applying labels.
- assign letter=E – assign the letter E to access from the browser.
Example 2: Convert a disk from MBR to GPT
- list disk
- select disk 2
- clean – essential to clean beforehand.
- convert gpt
Example 3: Expand the size of a partition
- list volume
- select volume 3
- extendsize=20480 – adds 20GB of contiguous unallocated space.
Example 4: Format a USB flash drive from Diskpart
- list disk – locate the USB memory number.
- select disk 3
- clean
- create partition primary
- Select Partition 1
- format fs = fat32 quick – ideal for compatibility with most devices.
- assign letter=H
Advanced commands, scripting, and automation
Diskpart supports automating complex tasks by running scripts written in text files. To do this, create a file with a .txt extension where each line is a valid Diskpart command. You can use the command rem to enter comments in the script. The file is executed with the command:
diskpart /s scriptname.txt
This method is ideal for mass deployments, unattended configurations, or maintenance routines. It is recommended to leave a few seconds between consecutive scripts by adding, for example, timeout /t 15 to avoid conflicts in responsive execution of Diskpart.
If an error occurs during script execution, Diskpart will notify you with a specific code and stop the sequence unless the parameter is included no err on the corresponding lines, allowing it to continue despite certain non-critical failures.
Passionate writer about the world of bytes and technology in general. I love sharing my knowledge through writing, and that's what I'll do on this blog, show you all the most interesting things about gadgets, software, hardware, tech trends, and more. My goal is to help you navigate the digital world in a simple and entertaining way.

Comments are closed.