How to Extend Partition with Diskpart Command Line

To extend a partition in Windows, you don’t have to use any third-party tools. You can simply use the built-in Diskpart command-line tool to do it. Let me show you how.

Though not often, there will be times when you need to extend a partition so as to increase it’s allocated space. For instance, I recently extended my VM drive where I store all my virtual machines. Generally, you need to use the built-in disk management or other third-party programs to extend the drive. However, that’s not necessary. If you need more control and don’t mind using a command-line tool then Diskpart is the way to go.

Diskpart is a built-in command-line tool that lets you create, delete, or extend partitions in Windows. Almost all the programs you see on the internet use Diskpart in the background to manage partitions.

Without further ado, follow the below steps to extend partition using Diskpart commands in Windows.

A Few Things You Should Know

Note: Only follow the below tutorial if you are fairly confident and know what you are doing. I assume you know a few things like unallocated space, file systems types, etc. If you don’t then either use the built-in GUI tool or third-party tools like Paragon or EaseUS.

Before proceeding, backup data in the drive you are trying to extend. That way, you will have access to the data even when something goes wrong.

  1. You cannot use the below method to extend boot partition a.k.a Windows installation drive.
  2. Diskpart can only extend partitions with the NTFS file system.
  3. The drive you are trying to extend should have an unallocated space right next to it.

Diskpart Commands to Extend Partition

1. First, search for “Command Prompt” in the start menu. Now, right-click on the result and select the “Run as administrator” option. Doing so will open an elevated CMD prompt.

2. In the elevated Command Prompt, execute the below command to initialize the Diskpart tool.

diskpart
Extend-partition-diskpart-command-open-diskpart

3. Now, execute the below command to list all disks in your system.

list disk
Extend-partition-diskpart-command-list-disks

3. Each disk has a number associated with it. For example, I have three hard drives in the system and they are numbered from 0 to 2. Use the below command to select the disk in which the partition you want to extend is located. Replace <number> with the actual disk number.

select disk <number>
Extend-partition-diskpart-command-select-disk

4. After selecting the disk, use the below command to list all the partitions in that specific disk drive.

list partition
Extend-partition-diskpart-command-list-partition

5. Just like with disks, partitions too are indexed and have numbers associated with them. Find the partition you want to extend and use the below command while replacing <number> with the actual partition index number.

select partition <number>

6. After selecting the partition you want to extend, use the below command while replacing <SizeInMB> with the actual size you want to extend in MB (Megabytes). For example, if you want to extend the partition by 1 GB, type 1024. You can use this tool to convert GBs to MBs.

Note: As I said above, this command will only work if there is sufficient unallocated space right next to the partition you are extending.

extend size=<SizeInMB>

7. Depending on the partition size, it can take some time to extend it. Once done, you will see “Diskpart successfully extended the volume” message.

8. Once you see this message, you are done with the procedure. Use the exit command to get out of the Diskpart tool. Next, close the Command Prompt and you are good to go.

Wrapping UP

That is all. It is that simple to use the Diskpart tool to extend partition in Windows. Sure, it is a bit more cumbersome and fairly limited but it is a great tool to learn some command line and know the backend procedure.

Hope that helps. If you are stuck or need some help, comment below and I will try to help as much as possible. If you like this article, do check out what is PortableBaseLayer partition and how to create recovery partition in Windows 10.

Leave a Comment

Scroll to Top