The Diskpart is a free disk utility that allows Windows users to manage disk partitions. However, to process specific orders to the Operating System, users need to know the right commands. This guide will help beginners learn what Diskpart does, how to use it to manage disk drives, and provide tips to fix Diskpart errors, ensuring data protection from being removed by these commands.
Let's see how to use Diskpart on your computer now.
In this article, you'll learn:
Diskpart is a newer command-line disk partitioning tool that replaces the older fdisk, allowing all Windows users to run Diskpart syntax parameters to manage disk partitions on desktop computers, laptops, and external storage devices.
Here is a list of basic information about Diskpart that you may feel like knowing:
The operating system processes the command parameters and applies the executions on the target hard drive partitions through a series of steps. First, the Diskpart utility is initialized, and the operating system loads the necessary drivers and libraries to interact with the hard drive partitions. Next, the user inputs a command, such as creating a new partition or formatting an existing one, and the Diskpart utility parses the command parameters to determine the specific action to take.
Step 1. Open the Diskpart.
Step 2. To create a new partition table on a disk, you can use the `parted` command with the `mktable` option. For example, on a disk named `/dev/sdb`, you can run `parted /dev/sdb mktable gpt` to create a GPT partition table.
Step 3. Focus on an object - the disk, volume, or partition:
Step 4. To process operation orders to the OS via specific Diskpart syntax parameters, you would use commands like `CREATE PARTITION PRIMARY` or `CREATE PARTITION EXTENDED` followed by the size of the partition, and then `SELECT DISK #` to specify the disk on which to perform the operation. For example, `CREATE PARTITION PRIMARY SIZE=1024` would create a primary partition of size 1024 MB on the disk selected by `SELECT DISK #`.
The diskpart command interpreter is a tool that helps manage a computer's drives, including disks, partitions, volumes, and virtual hard disks.
The diskpart utility is used for partitioning hard drives, but can also format removable media like flash drives.
Briefly, Diskpart could be applied to execute the following tasks:
Diskpart is a popular tool due to its numerous benefits. Its pros include being able to create, delete, and format partitions, as well as manage disk volumes and perform disk-related tasks. However, it also has some cons, such as being a command-line interface that can be intimidating for beginners, and requiring specific syntax for commands.
Pros of Diskpart:
Cons of Diskpart:
The command for formatting a volume is `FORMAT` and the command for creating a new partition is `CREATE PARTITION`. However, it's worth noting that the `CREATE PARTITION` command can be used in various ways, such as specifying the size and file system type of the new partition. For example, `CREATE PARTITION PRIMARY` or `CREATE PARTITION PRIMARY SIZE=1024 FS=NTFS`.
Diskpart Commands | Function |
---|---|
|
Get information about all disks on your computer. |
|
Get information about all partitions/volumes on a disk. |
|
To focus on a specific disk, partition, or volume, you can select it by its name or identifier, and then use the `*` symbol to indicate the number of selected items. For example, if you want to focus on the first disk, you can use `disk 0`, or if you want to focus on the first partition on the first disk, you can use `disk 0, partition 0`. The `*` symbol will be used to indicate that you are focusing on the selected item(s). |
|
Display detailed information about the selected disk, partition, or volume. |
|
1. Open a terminal and type "fdisk /dev/sdb" (replace "/dev/sdb" with your desired disk name) to enter the fdisk utility. 2. Press 'n' to create a new partition. |
|
To delete a specific disk, partition, or volume, you can use the "delete" command followed by the disk or partition number. For example, if you want to delete the first disk, you would type "delete 1". If you want to delete a specific partition, you would type "delete partition 1". If you want to delete a specific volume, you would type "delete volume 1". |
|
Convert a disk between basic and dynamic, MBR and GPT. |
|
Assign a drive letter to a new volume. |
|
To completely erase a hard drive or SSD, delete all partitions on the disk and remove all existing data. This will wipe out all existing data on the device. |
|
Format a partition or a volume, change its file system to NTFS, FAT32, exFAT, etc. |
|
Set a selected partition active. |
Note that We've only listed some common Diskpart commands here. If you need more advanced commands, you can refer to Microsoft's documentation at https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/diskpart for further assistance.
To access the Diskpart utility on a Windows computer, you can follow one of the four paths: on Windows 10/11, type "diskpart" in the Windows Search bar and press Enter; on Windows 8, go to the Start screen, type "diskpart" and press Enter; on Windows 7, click on the Start button, type "diskpart" in the Search bar, and press Enter; or, if you're using Windows XP, click on the Start button, select "Run", type "diskpart" and press Enter.
To manage your hard disk partitions or external storage devices, follow these steps: open Diskpart, and then use the respective Diskpart commands, such as list disk, select disk, list partition, select partition, delete partition, create partition, assign letter, and exit, to perform tasks like deleting, creating, and assigning drive letters to your storage devices.
To manage disk partitions using the Diskpart command, follow these steps: Use the Diskpart command to open the Diskpart utility, and then list the available disk partitions using the "list disk" command. Select the disk you want to manage using the "select disk" command, and then list the partitions on that disk using the "list partition" command.
Applies to: create a new simple volume, primary partition, or logical partition.
Step 1. Open Diskpart.
Step 2. Type list disk and hit Enter.
Step 3. To create a new partition on a specific disk, type `select disk *` and press Enter, replacing the asterisk with the number of the target disk you want to create a partition on.
Step 4. `fdisk /dev/sdb` or `parted /dev/sdb`
LEARN MORE
You can use Diskpart commands to create various types of volumes aside from primary or logical partitions, such as a boot volume, dynamic volume, RAID-5, and mirrored volume, among others. For more information on how to create volumes using Diskpart, you can visit the link that explains How to Create Volume by Using Diskpart.
Applies to: Format hard drive/SSD, quick format USB or external disks using Diskpart/CMD.
Step 1. Open Diskpart.
If you need to format an internal hard drive, you can skip Step 2. Just go ahead and format the drive using the built-in formatting tool, and then proceed with the installation of the operating system.
Step 2. Connect a removable external hard disk or USB to your PC.
Step 3. The command line "python -m pip install --upgrade pip" should be typed in one go, followed by hitting Enter. This command upgrades the pip package manager to the latest version.
Note that you need to repeat the process if you need to format multiple partitions on your computer.
Step 4. Type exit and close Diskpart when the process completes.
BONUS TIP:
How to Clean and Format a Disk Using Diskpart
You can also use the Diskpart Utility to clean and format a disk, making it like new. This process allows you to reuse the disk as a fresh storage device.
Applies to:To completely wipe a hard drive or solid state drive, you can use Diskpart to delete volumes, remove the recovery partition, clean the disk, or erase the entire drive.
To Delete Partitions from Hard Drive:
If you need to delete a recovery partition, replace "delete partition" with "delete partition override".
Bonus Tip:
To quickly delete all existing partitions on a disk, you can use the Diskpart utility, and follow the instructions provided in the link "How to Use Diskpart to Delete All Partitions".
To Cleanup or Erase Disk:
If you're about to wipe everything from your hard drive or SSD, the Diskpart Clean command is exactly what you need. To do this, you can follow a series of steps: first, open Command Prompt as an administrator, then type "diskpart" and press Enter to open the Diskpart tool, next type "list disk" and press Enter to list all available disks, identify the disk you want to clean and type "select disk X" (where X is the number of the disk you want to clean), then type "clean" and press Enter to clean the selected disk. This will completely erase all data on the disk, so make sure to back up any important files before proceeding.
If you need to continue using the disk for other purposes, you can revert to the first guide to Create Partition with Diskpart on the disk.
Applies to: Change disk type, convert MBR to GPT or GPT to MBR using Diskpart.
Bonus Tip:
Note that Diskpart will remove all existing partitions on a disk before converting its disk type to another one, making it a potentially data-losing solution. For a seamless conversion, consider using a third-party disk conversion tool, which can help you successfully convert a GPT disk to MBR without losing any data.
Alongside creating, formatting, cleaning, or converting disk partitions, Diskpart commands can also be used to extend, shrink, or make an active partition.
To Extend Partition with Diskpart:
To Shrink Partition with Diskpart:
To Mark Partition as Active with Diskpart:
Aside from using third-party software, you can also use Diskpart command lines to merge partitions, hide partitions, and even show hidden partitions.
While Diskpart is a free tool for Windows users to manage disks, its complexity can be a barrier for those with limited computing skills. A more user-friendly alternative is Qiling Partition Master Free, which offers reliable disk partition features that can fulfill various requests with simple clicks, making it a suitable replacement for Diskpart.
Bonus Tip:
If you're looking for free and equal tools to manage disk partitions, you can check out the best Diskpart alternatives for Windows 11, 10, 8, 7.
The Diskpart Utility can also be used to resolve common device errors, such as a storage device becoming RAW or a hard drive becoming read-only.
If you happen to have the same issue on your storage devices, follow the tips here, and you'll make your device work normally again:
Command: attributes disk clear readonly command
Applies to Fix: hard drive partition or storage devices show Read-only.
Step-By-Step Guide:
Step 1. To open Diskpart, click the Start menu, type 'cmd' in the search box, and hit Enter. Then, in the command prompt, type 'diskpart' and hit Enter.
Step 2. Type list disk and hit Enter.
Step 3. 1. Select the disk you want to format and hit Enter. (Replace * with the number of your disk, which is read-only.)
Step 4. Type attributes disk clear readonly and hit Enter.
LEARN MORE
The Disk Read Only error can be caused by various reasons, and aside from using Diskpart, other solutions include modifying the Registry, using read-only removal software, and other methods to fix the issue on your device. You can learn more about 5 methods to change a drive from read-only to read and write by following this link.
#2. Convert Device from RAW to NTFS
Command: chkdsk, format FS=NTFS
Applies to Fix: USB, hard drive, or external disk becomes RAW, inaccessible.
If you have essential data saved on a RAW device, you can use reliable data recovery software to scan and restore all content from the device first.
Step-by-Step Guide:
Step 1. Open Diskpart.
Step 2. 1. Open Command Prompt as Administrator. 2. Type `chkdsk E: /f /r /x` and hit enter.
Step 3. Type list partition and hit Enter.
Step 4. Run the command select partition * and hit Enter. (Replace * with the number of the RAW partition.)
Step 5. Type format fs=NTFS quick and hit Enter.
LEARN MORE
Aside from Diskpart, you can also apply disk management or a third-party disk partitioning software to get rid of the RAW issue on your device, by visiting the link: Convert RAW to NTFS to learn more details.
Many Windows users, both experienced and beginner, have reported encountering strange error messages from the Diskpart utility in the command prompt window.
If you're experiencing Diskpart errors, don't panic! You can resolve the issue by following the troubleshooting steps provided, which will help you eliminate the errors and get Diskpart functioning normally again.
Error 1: Diskpart I/O Device Error
Troubleshooting: Fix DiskPart I/O Device Error in Windows 10/8/7
Error 2: Diskpart Has Encountered an Error, Access Is Denied
Troubleshooting: How to Fix Diskpart Has Encountered an Error Access Is Denied Error
Error 3: Diskpart Failed to Clear disk Attributes
Troubleshooting: How to Fix Diskpart Failed to Clear Disk Attributes Error
Error 4: The System Cannot Find The File Specified
Troubleshooting:The "System Cannot Find The File Specified" error can be resolved with 8 fixes. Firstly, ensure the file path is correct and the file exists.
Error 5: Virtual Disk Service errors in Disk Part
Troubleshooting: How to Fix DiskPart Virtual Disk Service Errors
This page provides an in-depth look at Diskpart, including its capabilities, benefits, and common commands. Diskpart is a powerful tool that can perform various tasks, and its advantages include enhanced data management, improved system performance, and increased flexibility.
This page will guide you through mastering Diskpart commands to manage your hard drive partitions and external storage devices. By following this page, you'll learn how to effectively utilize Diskpart commands to manage your hard drive partitions and external storage devices.
You can apply some troubleshooting fixes to eliminate normal device errors like Read-only, or the device becomes RAW and makes your device function normally again.
For beginners, using Diskpart can be overwhelming, but there's an alternative. Qiling Partition Master Free is a helpful tool that can assist you in managing your disk partitions, saving your device from potential errors and bringing life back to your disk partitions.