• Buying Guides

Complete Guides by How-To Geek

Our latest product roundups, reader favorites, more from how-to geek, latest geek news, latest reviews, across lifesavvy media.

Join 425,000 subscribers and get a daily digest of news, geek trivia, and our feature articles.

By submitting your email, you agree to the Terms of Use and Privacy Policy .

How to Use the Diskpart Utility to Assign and Remove Drive Letters

Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work. Read more...

diskpart assign command

The Disk Management tool in Windows gives you an easy-to-use graphical interface to dealing with partitions and drive letters , but what if you want to just quickly change a drive letter on the command prompt? The diskpart utility makes it easy.

You’ll need to start by opening an administrator mode command prompt — type  cmd into the search box, and then right-click and choose Run as administrator, or use the CTRL + SHIFT + ENTER keyboard shortcut.

Once there, run the diskpart command, and then type in the following to list out the volumes on your system.

list volume

You’ll want to note the volume number next to the drive that you want to change the letter of. In our case, that number is 3.

Now we’ll use the select volume command to tell diskpart to make changes to that volume. If your drive number is different, you’ll want to replace the 3 with the number in your configuration.

select volume 3

You should see a message that the volume is now selected.

At this point you can easily assign a new drive letter. Just type in this command, substituting R for the drive letter you’d like to use:

assign letter=R

Make sure to hit enter once you’re done, of course.

Once you’ve made that change, your drive should show up again as a new device, and be available for browsing immediately.

If you want to unassign a drive letter in order to hide the drive, you can also use the remove letter command in the same way. We wouldn’t necessarily advise doing this, of course.

Don’t bother trying to change your C: drive, because that’s not going to work.

diskpart assign command

Diskpart Command

Use the 'diskpart' command to manage hard drive partitions.

Tim Fisher has more than 30 years' of professional technology experience. He's been writing about tech for more than two decades and serves as the SVP and General Manager of Lifewire.

diskpart assign command

In This Article

Jump to a Section

Related Commands

The diskpart Command Prompt command is used to create or delete partitions on hard drives .

Diskpart Command Availability

The diskpart command is available from within the Command Prompt in Windows operating systems, including Windows 11, 10, 8, etc.

You can also access this command from the Recovery Console in Windows 2000 and Windows XP.

Managing partitions is also possible without the use of a command from within any version of Windows using the Disk Management tool, or free disk partition software .

Diskpart Command Syntax

diskpart < parameter >

The availability of certain diskpart command switches and other syntax may differ from operating system to operating system. See  How to Read Command Syntax  if you're not sure how to read the syntax as it's described in this table.

Diskpart Command Examples

Here are some examples showing how the diskpart command can be used:

Create 5 GB Partition

In the above example, the diskpart command creates a 5,000 MB partition on the hard drive located at \Device\HardDisk0 .

Delete Partition by Name

For this one, the diskpart command will remove the Partition1 partition located on the hard drive \Device\HardDisk0 .

Delete Partition by Letter

This command will remove the partition currently assigned the drive letter G .

Select a Disk

Finally, in this multipart command, diskpart is being used to select a particular disk, disk 1 in this example, so we can remove the readonly attribute that's been set on it.

The fixboot , fixmbr , and bootcfg commands are often used with the diskpart command.

Get the Latest Tech News Delivered Every Day

By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts.

logo

Everything About DiskPart Commands in Windows 10

DiskPart is a command-line utility in Windows 10/11, enabling you to perform disk partition operations with commands. Learn how to use DiskPart commands with typical examples here.

diskpart assign command

What is DiskPart?

DiskPart, replacing its predecessor - fdisk, is a command-line utility that provides the ability to manage disks, partitions or volumes in your computer running all versions of the operating system since Windows 2000, also including the latest Windows 10. 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.

How to open DiskPart in Windows 10/11?

You will need to launch Windows 10/11 DiskPart with Administrator permission. One way is to type "diskpart" in the Search box, and then when diskpart appears in the search results, right-click it and select "Run as administrator". The other way is to press "Windows logo + R" keys and type "diskpart" in the box, and then click "OK".

Open DiskPart Windows 10

Common DiskPart Windows 10/11 commands (examples study)

Before you can use DiskPart commands in Windows 10, you must first list, and then select an object to give it focus. When an object has been focused, any DiskPart commands that you type will act on that object.

At the DISKPART> prompt, type "list disk" to display all the disks in your computer. Each one will have a specific disk number, starting with 0. An asterisk (*) under GPT row means the disk is of GPT partition style. Unless there is only one disk, you will have to tell DiskPart which disk to manage by using "select disk n" command to give it focus. n represents the number of the disk.

List Disk

At the DISKPART> prompt, type "list volume" to display all the volumes on all disks. Each one will have a specific volume number, starting with 0. To tell DiskPart which volume to manage, you need to type "select volume n" to give it focus. n can be the number of the volume or the drive letter of the volume if has.

List Volume

To view what DiskPart can for you, just type help to see a list of commands.

DiskPart Commands

Next, we will take some of the most common commands that Diskpart uses as examples for you to get a further understanding.

Section 1. Most common Diskpart commands on volume in Windows 10/11

Because when selecting a volume, the focus remains on it until you select a different volume, “select volume” command may not be used in each operation. Besides, the examples are performed one after one and the effect of the previous operation will be viewed in the next operation. If you only need to perform one of the operations, you need to select the volume before using the corresponding command.

➤ Note: Each time you type a command, you need to press "Enter" key to apply it.

1. Delete Volume

2. Create Partition

3. Format Partition

4. Assign Drive Letter

5. Extend Partition

6. Shrink Partition

7. Mark Partition as Active

To delete a volume, please refer to the following command:

▪ list volume

▪ select volume 6 (here take F: drive for example).

▪ delete volume

And then, you will receive a message says: DiskPart successfully deleted the volume.

Note: You cannot delete the system volume, boot volume, or any volume that contains the active paging file or crash dump.

Delete Volume

To create a partition, please refer to the following command:

▪ create partition primary size=102400

And then, you will receive a message says: DiskPart succeeded in creating the specified partition.

Create Partition

The above command means to create a 102400MB (100GB) primary partition. To create other types of partition, you just need to replace primary with one of the followings:

Create Partition Type

➧Note: To create a partition, there must be unallocated space on the disk.

Type list volume command, you will find the new created partition is RAW, which means you must format partition before you can use it. To format a partition, please refer to the following command:

▪ format fs=ntfs label="Windows 7" quick

And then, you will receive a message says: DiskPart successfully formatted the volume.

The above command means to perform a quick format on the partition. It will be formatted with NTFS file system and labeled as Windows 7. To create other file system partition like FAT, FAT32, you just need to replace ntfs with fat or fat32. The label can be any name as you like.

Format Partition

➧Note: DiskPart cannot format 32GB+ partition to FAT32. To format a large hard drive to FAT32 , you have to turn to a third-party partition manager.

A partition without a drive letter will be hidden under "File Explorer". To assign a drive letter to an existing partition, please refer to the following command:

▪ assign letter=F (F can be replaced with another letter that has not been used yet).

And then, you will receive a message says: DiskPart successfully assigned the drive letter or mount point.

Assign Drive Letter

To extend a partition, please refer to the following command:

▪ extend size=20480

And then, you will receive a message says: DiskPart successfully extended the volume.

The above command means to add 20480MB (20GB) to the volume 6. If no size is given, all of the contiguous unallocated space on its right side will be added.

Extend Partition

➧Note: To extend a partition, there must be contiguous unallocated space on its right side.

To shrink a partition, please refer to the following command:

▪ shrink desired=10240

And then, you will receive a message says: DiskPart successfully shrunk the volume by 10GB.

Shrink Volume

➧Note: You can reduce the size of a volume only if it is formatted using the NTFS file system.

To mark a partition as active, please refer to the following command:

And then, you will receive a message says: DiskPart marked the current partition as active.

Mark as Active

Section 2. Most Common Commands on Disk in Windows 10/11

The most common diskpart commands used on the disk should be the MBR and GPT conversion. To delete all partitions or volumes on a disk and convert the disk between MBR and GPT, please refer to the following command:

▪ list disk

▪ select disk 1

▪ "convert gpt" or "convert mbr".

Clean Convert Disk

Free alternative to Windows 10/11 DiskPart Utility

As DiskPart alternative, AOMEI Partition Assistant Standard is a free partition manager software and disk management tool, which provides more features than DiskPart. It not only supports Windows 10, but also supports Windows 11/8.1/8, Windows 7, Vista, and XP. You can also resize the BitLocker partition  when it is running out of space. With a user-friendly interface, it is very easy to use.

To perform an operation on a partition, you just need to right-click on it. The operations supported by AOMEI Partition Assistant Standard are as below:

Operation On Partition

The operations of disk management and step-by-step wizards are as below:

Operation On Disk

DiskPart in Windows 10/11 can meet the basic requirement of most users. And the free AOMEI Partition Assistant is more advanced than it and provides more amazing features. For example, it can extend/shrink both FAT32 and NTFS partition. For extending a partition, its “ Merge partition ” allows users to add non-adjacent unallocated space into the target partition. It is able to format large partition (2TB at most) to FAT32 file system. For partition style conversion, it can convert data disk between MBR and GPT without deleting partitions.

You can download this freeware and have a try. To get more advanced features, such as converting dynamic disk into basic without losing data, recovering lost partition, you can upgrade AOMEI Partition Assistant Standard to Professional version.

Free Partition Manager

diskpart assign command

diskpart assign command

Download.com Rating

diskpart assign command

Still Need Help?

Have your problem been solved? If not, please input query in the search box below.

site logo

How to Use DiskPart Utility in Windows

Format, resize, extend and manage your drives

Author avatar

The Disk Management Tool is a useful, effective tool for managing your Windows disks and partitions, but it isn’t as powerful to use as Diskpart. This command-line tool lets you delete, create and modify partitions on any hard drives or USB storage your PC can detect.

We’d recommend using the Disk Management Tool for most situations, but if Windows isn’t starting up properly, or if you prefer to use the PowerShell terminal , Diskpart is the perfect alternative. Here are some of the more common Diskpart commands to help you learn how to use Diskpart effectively.

diskpart assign command

How To Use Diskpart

If you want to use Diskpart, you need to open up a Windows command line or PowerShell terminal. Diskpart is a destructive tool, so you’ll need to open a terminal window with the right administrative privileges.

diskpart assign command

diskpart assign command

diskpart assign command

We’ll explore some of the most common Diskpart commands in this article, but if you want to quickly see the full list of available Diskpart commands, type help at the “DISKPART>” prompt and hit enter.

diskpart assign command

Listing Existing Hard Drives, Volumes & Partitions

Once Diskpart is open, the first thing you should do is check the current layout of your hard drives and attached storage.

diskpart assign command

diskpart assign command

diskpart assign command

Deleting a Hard Drive Partition Or Volume Using Diskpart

A hard drive (disk) is separated into partitions, which are often the same as listed volumes. If your hard drive is separated into several partitions or volumes, and you wish to delete one, you can do that using Diskpart commands.

diskpart assign command

diskpart assign command

Wiping a Hard Drive Completely Using Diskpart Clean

Rather than removing individual volumes or partitions on a drive, you can wipe a hard drive completely using the Diskpart clean command. You can also use this command if you’re looking to wipe a USB flash drive, ready for formatting.

You won’t be able to do this on your system drive (nor would you want to!) unless you’re using Diskpart on a Windows installation

diskpart assign command

diskpart assign command

Creating & Formatting New Hard Drive Partitions  

With a “clean” drive, you’re ready to create a partition in the free space using the Diskpart create partition command. You can then format that new partition with a Windows-friendly file system like NTFS or FAT32 using the Diskpart format command.

diskpart assign command

diskpart assign command

diskpart assign command

diskpart assign command

Extend a Hard Drive Volume

If you have an existing hard drive volume that doesn’t take up all of the free space on a drive, and you wish to enlarge it, Diskpart commands allow you to do that.

diskpart assign command

Diskpart has other options available, as the help command briefly explains. If you need further information on how to use Diskpart, Microsoft has further Diskpart support information available.

diskpart assign command

Ben Stockton is a freelance technology writer based in the United Kingdom. In a past life, Ben was a college lecturer in the UK, training teens and adults. Since leaving the classroom, Ben has taken his teaching experience and applied it to writing tech how-to guides and tutorials, specialising in Linux, Windows, and Android. He has a degree in History and a postgraduate qualification in Computing. Read Ben's Full Bio

Read More Posts:

diskpart assign command

Subscribe to Help Desk Geek.

Join 30,000+ others who get daily tips, tricks and shortcuts delivered straight to their inbox. 

Thanks for subscribing!

We will never spam you, unsubscribe at any time.

diskpart assign command

.shock - Fotolia

Using Diskpart to create, delete, clean or extend disk partitions

The diskpart is one of the oldest tools in the Windows operating system that handles a wide range of disk management jobs, such as assigning drive letters and deleting partitions.

For basic disk operations on Windows systems, administrators can use diskpart , a command-line utility that remains useful for many different drive-related jobs more than 20 years after it was released.

Microsoft included the free disk management tool in Windows starting in 1999 with the Windows 2000 operating system. Diskpart scans for newly added disks, but it can also create, delete and resize drive partitions , and assign or reassign drive letters. Diskpart also works with drive volumes, virtual hard disks and removable media such as USB flash drives.

Microsoft continues to develop diskpart, and the latest version of the utility features 38 commands. To use diskpart, you list the objects, such as disks or partitions, and then select the object to change it.

diskpart commands

Using diskpart requires understanding data storage terminology

Diskpart use requires a basic understanding of Windows disk terminology . A basic disk is a storage device, such as hard drives, solid-state drives and USB flash drives, which you format with a Windows file system .

A basic disk can hold one or several partitions. A partition is a logical structure confined to a single disk.

A volume is a construct of the operating system that consists of one or more partitions that can span one or more disks.

Using diskpart

You should be careful when using diskpart because there is no undo function if you select the wrong object. Also, once a command is entered, even a destructive one, diskpart does not ask for confirmation before it runs. For example, if you perform an errant diskpart delete partition operation, you must use another utility, such as third-party disk management program, to recover the data or use a backup image to restore the drive.

Follow these tips to avoid issues when using diskpart:

Creating a partition using diskpart

Using diskpart to partition your disk can help increase the I/O performance of hard disks newly added to a RAID array . The documentation for many server applications, such as Exchange Server, recommends using diskpart to create the primary or extended partitions. You can use a primary partition as the system partition; you can only use an extended partition for additional logical drive assignments.

The diskpart create command makes disk partitions, volumes on a single disk or multiple disks, and virtual hard disks.

For this and all following commands, you need to open the command prompt before you run diskpart. Type cmd from the run command window from the Windows search box or the run command dialog box that you open with the Windows+R key combination.

To create a partition:

diskpart create partition

Extending a partition using diskpart

When it comes to adding space to a partition or volume, this method is superior to configuring two disks. Dynamic disk extensions only concatenate the newly added space, meaning they merely add the disk space to the end of the original partition without restriping the data.

Concatenation isolates performance within each partition and does not offer fault tolerance when the partition is configured in a RAID array. Diskpart restripes your existing data. This is beneficial when the partition is set up in a RAID array, because the existing partition data spreads across all the drives in the array, rather than just adding new space to the end, like the Disk Management utility.

To extend a partition:

diskpart extend partition

Deleting a partition using diskpart

The delete command in diskpart removes dynamic disks, partitions, volumes and shadow copies. When you have multiple volumes on the disk or an unwanted partition, such as a recovery partition , this command will remove them and return them to unallocated space.

To delete a partition:

diskpart extend partition

Creating a volume using diskpart

When using dynamic disks in Windows, you can create four volume types with diskpart: volume mirror, RAID-5 volume , simple volume and striped volume.

To create a simple volume :

Cleaning a disk using diskpart

When you have an entire disk to wipe clean, you can use the diskpart clean command to convert all the stored data into unallocated space. This operation deletes all data on the disk by writing zeros on each disk sector. Diskpart also removes all partition and volume information from the selected drive.

To clean a disk :

Other ways to use diskpart

For maintenance work that requires a bootable USB flash drive, you can use diskpart to format the partition and set up the file system on the removable drive. Administrators can also use diskpart in both the Windows Preinstallation Environment and Windows Recovery Environment to correct disk problems or set up the machine for deployment.

With the diskpart /s switch, administrators can run scripts to automate tasks associated with setting up Windows machines, such as configuring the disks for multiple systems, adding a recovery partition or wiping all data from a disk to return it to a factory state.

Sample code from the Microsoft site gives examples of how to develop a text-based script file administrators can call from diskpart and run automatically. IT workers can run several diskpart scripts, but Microsoft recommends building in a delay of 15 seconds after a script runs to prevent issues.

For an in-depth tutorial on how to use diskpart for preparing a Windows 10 system for deployment, this blog post on the SearchEnterpriseDesktop site provides detailed instructions to use diskpart with a script .

Dig Deeper on Windows Server OS and management

diskpart assign command

diskpart (Disk Partition Utility)

AndrewZola

How to create a custom ISO for Windows 10

KariFinn

Windows 10 disk management terms and tasks IT should know

GaryOlsen

Delete the Windows recovery partition on a Lenovo Thinkpad or Desktop

CameronMcKenzie

Part of: Windows disk and file server management tips for admins

Learn how to generate a detailed report that uncovers unusual activity by users on a Windows file share without having to manually investigate every file and folder.

Microsoft's Azure Files offering alleviates traditional support efforts and hardware costs. Using this additional service can improve performance and keep end users happy.

Learn how to use the clustering tools provided by the Microsoft server OS to create a highly available file server to avoid downtime if disaster strikes.

A file server deployment must satisfy the needs of both the end user and the IT staff. Tune up Windows Server for a secure and performant repository for your critical data.

Many organizations still need a file server, but some of the advantages of Microsoft's cloud storage option might persuade companies to make the switch.

AWS Compute Optimizer and Cost Explorer monitor, analyze and optimize your cloud costs. Compare the two tools to choose which is ...

Azure management groups, subscriptions, resource groups and resources are not mutually exclusive. Businesses can -- and often do ...

Amazon CodeGuru reviews code and suggests improvements to users looking to make their code more efficient as well as optimize ...

Before organizations migrate to Windows 11, they must determine what the best options are for licensing. Learn about the choices ...

UEM software is vital for helping IT manage every type of endpoint an organization uses. Explore some of the top vendors and how ...

Office 365 MDM and Intune both offer the ability to manage mobile devices, but Intune provides deeper management and security. ...

Many organizations will go with remote and virtual desktop services from Citrix, Microsoft and VMware, but there are many ...

When the keyboard for a remote desktop isn't working, sys admins will need to run through these steps to find the root cause of ...

Running a remote desktop comes with all sorts of hardware considerations for IT to address, including how the desktop interacts ...

How to assign permanent letters to drives on Windows 10

You can assign drive letters manually, and in this guide, we show you how on Windows 10.

diskpart assign command

On Windows 10, when connecting a removable storage device or an internal hard drive, the system detects and assigns a drive letter automatically to make it usable. However, when reconnecting an external drive (such as a USB flash drive or SD or microSD cards), the system can end up assigning a different letter, which can be annoying.

If you want to see the same drive letter on a particular device, you can manually assign a permanent letter to any drive connected to your computer, and on Windows 10 , you can do this in at least three different ways, using Disk Management, Command Prompt, or PowerShell.

Using this approach will prevent Windows 10 from assigning a new letter or trying to set a letter already in use, which can cause conflicts. Also, it helps to select a drive letter that makes more sense to you.

In this Windows 10 guide, we walk you through several methods to manually assign a permanent letter to a drive, as long as you're connecting the drive to the same device and the letter isn't already in use.

How to assign a drive letter using Disk Management

How to assign a drive letter using command prompt, how to assign a drive letter using powershell.

To manage drive letters with the Disk Management tool, use these steps:

Once you complete these steps, the drive will permanently retain the assigned letter, even after reconnecting it. However, if you connect the drive to another device, it may receive a different letter.

While the easiest way to assign a new drive letter is to use Disk Management, you can also use DiskPart in Command Prompt to perform the same task.

To assign a drive letter using Command Prompt, use these steps:

After completing these steps, similar to Disk Management, every time you reconnect the storage to the same device, Windows 10 should assign the same letter automatically.

Alternatively, you can also use PowerShell to change a drive letter on Windows 10 using these steps:

Once you complete the steps, the drive will be accessible through File Explorer using the letter that you assigned, and Windows 10 won't try to change it.

Updated March 7, 2019: We revised this guide to make sure it's current with the latest version of Windows 10.

More Windows 10 resources

For more helpful articles, coverage, and answers to common questions about Windows 10, visit the following resources:

Windows Central Newsletter

Get the best of Windows Central in your inbox, every day!

Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he's a recognized member of the Microsoft MVP community.

Thank you for signing up to Windows Central. You will receive a verification email shortly.

There was a problem. Please refresh the page and try again.

Knowledge Base

Support downloads, suggested searches, select your country/region.

Asia-Pacific (APAC)

Middle East/North Africa

Latin America

North America

diskpart assign command

Provides access to product training, sales and marketing resources, deal registration, and more to our VARs, Integrators, Resellers and other channel partners.

diskpart assign command

Use the Lyve Cloud portal to configure and manage your object storage and services.

diskpart assign command

Provides Direct customers with B2B Self Service tools such as Pricing, Programs, Ordering, Returns and Billing.

diskpart assign command

Register, access, and manage Lyve Mobile services, subscriptions and projects.

diskpart assign command

Provides Suppliers with self-service tools targeted to the needs of their business.

diskpart assign command

View registered products, register new products, and find product specific support.

View/edit your profile information

View your dashboard

Logout of your account

How to Diskpart Erase/Clean a Drive Through the Command Prompt

Twitter Facebook Google Plus Linked in

Critical Instructions:

Items to note:

Shows disk management with a properties box open. Disk 1 is squared off and there is an arrow pointing to

Multicloud Maturity Report

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

create partition primary

Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

Creates a primary partition on the basic disk with focus. After the partition has been created, the focus automatically shifts to the new partition.

A basic disk must be selected for this operation to succeed. You must use the select disk command to select a basic disk and shift the focus to it.

To create a primary partition of 1000 megabytes in size, type:

Related links

Command-Line Syntax Key

assign command

create command

select disk

Submit and view feedback for

Additional resources

Article Number: 000136959

How to Make a Bootable USB Flash Drive Using Diskpart

Summary: how to make a usb flash drive bootable using the diskpart utility., article content, article properties.

This article provides instructions on how to create a bootable USB flash drive using the Diskpart utility.

Not applicable.

Table of Contents:

1. Create a bootable USB flash drive using the Diskpart utility

A user may want to create a bootable USB flash drive which has a larger partition than the maximum 2 GB created using the Dell Diagnostic Distribution Package (DDDP), see Article  How to Create a Bootable USB Flash Drive using Dell Diagnostic Deployment Package (DDDP) .

Diskpart can be used to create a partition larger than 2 GB on the USB flash drive so larger files can be used. Diskpart is a Disk Partition utility available within Windows.

Follow the steps in the next section on how to use Diskpart to create a bootable Windows USB flash drive:

Back to Top

2. How to use Diskpart

Insert your USB flash drive (4 GB or larger preferable) into your system.

Go to the Command Prompt. Select Start and type  CMD  in the search field, right click on CMD.exe and select Run as administrator . Alternatively, go to Start > All programs > Accessories > right click on Command Prompt and select Run as administrator .

SLN153364_en_US__3cmd_admin

A User Account Control (UAC) dialog Window may appear. Click  Yes  to Continue.

When the Command Prompt opens, enter the following commands followed by Enter :

DISKPART - This starts the utility.

LIST DISK - This shows the disk number of your USB flash drive. In the image below the USB flash drive shows as Disk 2.

SLN153364_en_US__41368538222182.diskpart

SELECT DISK X (Replace X with your USB flash drive number, we are using 2 in this example).

CLEAN - This wipes the drive.

CREATE PARTITION PRIMARY - Creates a partition.

SELECT PARTITION 1 - Selects partition 1.

ACTIVE - Marks the current partition as active.

FORMAT FS=NTFS QUICK - This formats the partition.

ASSIGN - Assigns a drive letter.

Insert your Windows DVD into the optical drive. From Command Prompt, enter the following:

SLN153364_en_US__5cmd_boot

Copy all files from the Windows CD to the USB flash drive using xcopy

This copies the Windows installation files onto the USB flash drive, it may take several minutes.

xcopy switches are as follows: /s - Copies directories and subdirectories except empty ones. /h - Copies hidden and system files. /f - Displays full source and destination filenames while copying. To display the full list of switches, type xcopy /? <enter>

This makes the USB drive bootable. When selected at startup, it boots straight into the Windows installation.

Affected Product

Storage, Drives & Media, Inspiron, Latitude, Vostro, XPS, Retired Models, Fixed Workstations

Last Published Date

04 Aug 2022

Article Type

diskpart assign command

Related Articles

Diskpart Command in Windows

DiskPart is a powerful tool for disk management under Windows OS. Diskpart Command is used to manage the computer hard drive, partitions, and volumes. This Command is not only limited to Windows 10 but also available in Windows 8.1,8,7 or even in Windows 2000. The Diskpart is used from creating or deleting partitions to wiping the drive clean or fixing errors on drives.

Diskpart looks similar to the Disk Management tool, but the only difference is that diskpart is a command prompt utility which makes it more powerful and provides more functionality than the Disk Management tool.

Let us see how Diskpart can help you to manage your drives, partitions, and volumes.

Note: You should always run your computer in Administrator mode while you are making use of DiskPart.

Parameters:

You can run the following commands from the Diskpart command interpreter:

Open and List Drives or Partitions or Volumes:

It is important to list the drives, partitions, or volumes before we go ahead and implement DiskPart commands on them. Follow the below-mentioned steps to list the drives:

The above article, explains the use cases and parameters of the diskpart command on Windows.

Please Login to comment...

New Course Launch!

Improve your Coding Skills with Practice

Start your coding journey now.

More Recovery Products

Centralized Solutions

MSPs Service

Screen Capture

Video Toolkit

Audio Tools

Transfer Products

File Management

iOS Utilities

More Products

How to Create Volume/Partition Using Diskpart? [Full Guide]

Diskpart is a built-in disk tutility that offers multiple ways to assist you creating partition and handling volumes in Windows 11/10. Our article shows you how to use Diskpart to create partition and other Diskpart commands that could be applied to create boot volume, system volume, dynamic volume, RAID-5 volume, Mirrored System volume, and UEFI system volume.

 Windows 11/10/8/7  100% Secure

diskpart assign command

What Is Diskpart

Featured Articles

This page covers multiple Diskpart commands, you can apply to create partitions and volumes using Diskpart as shown here:

How Do I Create a New Volume in Diskpart

Diskpart , also known as Windows built-in free disk utility, it presents Windows users with multiple features in managing disk partitions, fixing device errors, programming, developing, and testing, etc. Due to its high accessibility, free-to-use, and flexibility, Diskpart is popular among Windows users for manaing hard drive partitions.

If your partitions are not well managed, your system may have a lot of free unallocated space. Therefore, Windows users oftern use the Diskpart create partition command to manage their system drives and storage devices.

There are different types of partitions that you can create in Windows. You can do it all using Diskpart to create partitions in Windows 11/10 with different commands no matter the partition type.

Here, our article will show you an in-detail step-by-step guide to using Windows diskpart command to create partitions.

There are detailed guides on how to use Diskpart to create different volumes. Share this article to help other users having the same issues.

#1. Use Diskpart to Create Partition/Volume

Diskpart create partition is a built-in command in Windows operating system. Using this command, you can manage, create, and edit your partitions in Windows OS. Let's see below how to create different partition volumes using the diskpart command.

1. Create System Volume, Primary Partition Using Diskpart

Diskpart command also allows you to create system volume. System volume, also known as the primary partition, which is the place where your operating system and propgrams are installed.

Follow the below steps to create system volume using the diskpart command:

Step 1: Open CMD on your Windows computer.

Step 2: Enter diskpart and then Type  list disk.

Step 3: Select a disk using the select disk x command. (Replace x with the number of the disk you wish to select)

Step 4: Type the command create partition primary size=20480  to initialize a new partition with a size.

Entering the above will create a primary system volume partition. If you need to create a logical partitoin, replace  create partition primary with  create partition logical . Also, you can change the size according to your needs.

create system volume

Step 5.  Type  exit  to close Diskpart when the process completes.

After creating a system volume partition, you can clean install a Windows or applications in it.

related articles

[Infographic] Create Partiton Using Diskpart, Disk Management, and Software

Alongside Diskpart, you can also create partition using Disk Management or third-party partition manager software like EaseUS Partition Master. Follow this guide to learn the difference and detailed steps.

Create partition using software

2. Create Boot Volume Using Diskpart

Boot volume is the primary partition of your operating system. It's also known as a bootable partition. All your operating system files are stored in this partition. In simple terms, your operating system resides in the boot volume portion.

To allow computer load the boot information, you'll also need to mark the boot volume active. Follow the below steps to create a boot volume using the diskpart command in Windows operating system:

You can do that by pressing the "Windows + R" key, which will open a Run box. Type  cmd  and hit OK .

opening cmd

Step 2: In CMD, enter the diskpart  command and open the diskpart utility.

Step 3: Type  list disk  and press enter to list all your disks.

Step 4: Select a disk using   the  select disk x command. (Replace x with the number of the disk you wish to select)

Step 5: Enter the list volume  command to see available volumes for your disk.

Step 6: Enter the select volume n command to select the volume you wish to make as a boot partition. (n is the number for your volume)

Step 7: Enter the active  command, and you will have the specified volume as a boot partition.

Now, exit CMD, and restart your system to see the changes.

create boot volume

3. Create Dynamic Volume Using Diskpart

Dynamic volume disk allows you to manage your disks with more flexibility.

You don't have to specify a size while creating a dynamic partition disk. Your disk can evolve and grow over time.

Follow the below steps to create a dynamic volume using the diskpart command:

Step 2: Type  diskpart.

Step 3: Type  list disk.

Step 4: Type  list volume.

Step 5: Select a disk using the select disk x command. (Replace x with the number of the disk you wish to select)

Step 6: Type the convert dynamic  command to convert your selected volume to a dynamic volume.

convert dynamic

4. Create RAID-5 Volume via Diskpart Commands

RAID-5 (A redundant array of independent disks) is a type of disk volume that efficiently utilizes your storage. Along with better storage management, it gives you good security and disk performance.

Follow the below steps to create RAID-5 volume using the diskpart command:

Step 3: Type  list disk to see your current disk numbers.

Step 4: Enter create volume raid disk=1 (Here 1 is the disk number that you are creating as RAID-5 volume. You can change this number with other disk numbers).

diskpart create raid volume

5. Create Mirrored System Volume

The mirrored system partition allows you to create a clone of data from another volume. Primarily, users need it for creating backup device data. Follow the below steps to create mirrored system volume using diskpart:

Step 3: Type  list disk and then a select disk which volume you want to mirror by selecting disk x  command.

Step 4: Type  list volume to list the volume of the selected disk.

Step 5: Now, type the select volume c  command to choose the volume you want to mirror to a disk. (replace c with the volume alphabet of your choice)

Step 6: Enter the command add disk=x  (replace x with the disk where you want a backup of the selected volume).

Step 7: Enter the retain command, and you will be able to create mirrored system volume successfully.

diskpart mirrored

6. Create UEFI System Volume

UEFI (Unified Extensible Firmware Interface) system volume holds your system initialization and startup information. You can create UEFI system volume using diskpart by following the commands below:

Step 2: Type  diskpart in CMD and press enter.

Step 3: Enter the list disk command and select disk x  to select the disk.

Step 4: Convert your selected disk to GPT using the convert gpt  command.

Step 5: Now create the UEFI system partition using create partition efi size=100  

That's it, entering this command will create a UEFI system volume on your selected disk.

creating uefi partition

#2. Diskpart Alternative Software Free Download - EaseUS Partition Master

Using diskpart creat partition commands, you can create partition volumes of any type. However, this method is not suited for beginners and people that have not interacted with command-line interfaces.

An alternate solution is to use EaseUS Partition Master Free  which is a reliable disk partition software that perfectly replaces Diskpart.

EaseUS Partition Master Free edition helps you convert your partitions, manage the partitions, and create new partitions. It is a GUI-based tool, which means you do not have to remember or enter any command.

Using simple clicks, you can easily create a partitioned volume of your choice. It is highly recommended because a user with any computer expertise can smoothly use this software.

Step to use EaseUS Partition Master

Step 1. Launch EaseUS Partition Master. On the main window, right-click on the unallocated space on your hard drive or external storage device and select "Create".

Step 2. Adjust the partition size, file system (Choose the file system based on your need), label, etc. for the new partition and click "OK" to continue.

Step 3. Click on the "Execute 1 Task(s)" button and create a new partition by clicking "Apply".

Watch the following video tutorial and learn how to create a partition in NTFS, FAT, or EXT file system.

There are various types of partitions in the Windows computer system. Such as boot volume, system volume, dynamic volume, RAID-5 volume, mirrored system volume, and UEFI system volume.

Diskpart create partition command helps you to create these partitions in Windows. The diskpart utility is built-in, and you can access it through CMD without needing any software installation.

Unfortunately, entering commands to create partitions is not everyone's cup of tea. There is another easy way to create partitions in the Windows operating system for people who struggle with commands.

The alternate method is to use EaseUS Partition Master Free edition software. It does everything that the diskpart command does, but with just a few clicks.

FAQs about Creating Partitions Using Diskpart

Aside from the above tutorials, some of you may also have questions about creating other types of partitions by using Diskpart. Check the questions here, and hope you find desired answers ans solutions here.

1. How do I crate a GPT Partition Using Diskpart?

If yes, continue with the steps here:

If not, back up all data to another drive, then continue with steps here:

2. How do I create a MBR partition using Diskpart?

If yes, follow the steps below:

If not, back up all valauble data to another drive, then follow the steps here:

3. How to create multiple partitions usign Diskpart

Repeat the process until you create multiple partitions on the target disk. Note that the MBR disk only alows creating up to 4 primary partitions. If you want more than 4 primary partitions on the disk, you'll need to convert the MBR disk to GPT first. 

Was This Page Helpful?

diskpart assign command

Updated by Sherly

Sherly joined EaseUS in 2022 and she has always loved writing articles and enjoys the fun they bring. She receives professional training here, focusing on product performance and other relative knowledge.

Read full bio

diskpart assign command

Written by Tracy King 

Tracy joined in EaseUS in 2013 and has been working with EaseUS content team for over 10 years. Being enthusiastic in computing and technology, she writes tech how-to articles and share technical solutions to resolve Windows & Mac data recovery, data backup, partition management, data transfer, Windows update issues, etc.

Related Articles

How to Burn ISO to USB on Windows 10, Here Is Full Guide

author icon

What Is USB Write Protected Formatter and How to Use It? [2023 Guide]

author icon

Windows 11 Download Without TPM 2.0 & Run Windows 11 Without TPM

author icon

[Allocation Unit Size FAT32 Guide] What Allocation Unit Size Should I Use for FAT32

diskpart assign command

Copyright ©   EaseUS. ALL RIGHTS RESERVED.

IMAGES

  1. How to Initialize SSD on Windows 10,8,7?

    diskpart assign command

  2. What Is DiskPart and How to Use It? (Ultimate Guide & Tips)

    diskpart assign command

  3. What Is Diskpart Format? Any Alternative to It? [2022 Guide]

    diskpart assign command

  4. Diskpart extend C drive volume in Windows Server 2019/2022

    diskpart assign command

  5. How to Use Diskpart to Recovery Partition in Windows 10, 8 or 7?

    diskpart assign command

  6. Diskpart to extend partition/volume on Windows Server 2003 r2

    diskpart assign command

VIDEO

  1. how to use a diskpart in using a cmd

  2. How to Delete Partition from Command Prompt

  3. Hide & Unhide Local Disk Drive Using CMD Diskpart

  4. Disk Part Command in Hindi

  5. Installing Windows OS using Bootable Flash Drive

  6. How to use diskpart as a batch program || how to make batch file of diskpart

COMMENTS

  1. 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 diskpart commands that you type will act on that object. Determine focus

  2. assign

    In addition, you cannot assign a drive letter to an Original Equipment Manufacturer (OEM) partition or any GUID Partition Table (gpt) partition other than a basic data partition. Syntax assign [ {letter=<d> | mount=<path>}] [noerr] Parameters Examples To assign the letter E to the volume in focus, type: assign letter=e Related links

  3. How to Use the Diskpart Utility to Assign and Remove Drive Letters

    The diskpart utility makes it easy. You'll need to start by opening an administrator mode command prompt — type cmd into the search box, and then right-click and choose Run as administrator, or use the CTRL + SHIFT + ENTER keyboard shortcut. Once there, run the diskpart command, and then type in the following to list out the volumes on your system.

  4. Diskpart Command (Examples, Options, Switches & More)

    The diskpart Command Prompt command is used to create or delete partitions on hard drives . Diskpart Command Availability The diskpart command is available from within the Command Prompt in Windows operating systems, including Windows 11, 10, 8, etc. You can also access this command from the Recovery Console in Windows 2000 and Windows XP.

  5. diskpart scripts and examples

    To run a diskpart script, at the command prompt, type the following command, where scriptname is the name of the text file that contains your script: diskpart /s scriptname.txt To redirect diskpart's scripting output to a file, type the following command, where logfile is the name of the text file where diskpart writes its output:

  6. [Free Guide]: Use Diskpart Assign Drive Letter in Windows 11, 10, 8, 7

    In addition to Diskpart, Disk Management may be another good choice to assign drive letter. Step 1. Press " Win + R " to open the " Run " window and type diskmgmt.msc in the box. Step 2. Right-click the drive you want to assign, and select change Drive Letter and Paths in the pop-up window. Step 3. Click Change to summon the next window.

  7. Everything About DiskPart Commands in Windows 10

    To assign a drive letter to an existing partition, please refer to the following command: assign letter=F (F can be replaced with another letter that has not been used yet). And then, you will receive a message says: DiskPart successfully assigned the drive letter or mount point. 5. Extend Partition

  8. How to Use DiskPart Utility in Windows

    To open Diskpart in Windows, right-click your Windows Start menu button and click Windows PowerShell (Admin). In your admin-level PowerShell terminal (or similar Windows command line), type diskpart and hit enter. The Diskpart tool will launch within the window, ready for you to use. Type exit at the "DISKPART>" prompt and hit enter once ...

  9. How to use diskpart, chkdsk, defrag and other disk-related commands

    In Command Prompt or PowerShell, type diskpart to access the Windows tool called Diskpart. Launching diskpart in Command Prompt After you have launched diskpart it is time to establish which hard disk or solid state drive you want to use for creating a new partition. You can select the drive with the select command.

  10. How to use DiskPart to clean and format drive not working on Windows 10

    Search for Command Prompt, right-click the top result, and select the Run as administrator option. Type the following command to launch DiskPart and press Enter: diskpart Type the following...

  11. Assign a mount point folder path to a drive.

    Open a command prompt and type diskpart. At the DISKPART prompt, type list volume, making note of the volume number you want to assign the path to. At the DISKPART prompt, type select volume <volumenumber>, specifying the volume number that you want to assign the path to. At the DISKPART prompt, type assign [mount=<path>]. To remove a mount point

  12. Using Diskpart to create, delete, clean or extend disk partitions

    At the DISKPART prompt, type assign letter=D (Choose an unused drive letter.) At the DISKPART prompt, type exit From the command prompt, use the format command, or the Disk Management utility in Windows or any disk format tool to format the drive. You would typically use the NTFS file system during the initialization process.

  13. How to assign permanent letters to drives on Windows 10

    Type the following command to assign a permanent letter to the drive and press Enter: Get-Partition -DiskNumber 1 | Set-Partition -NewDriveLetter Z In the command, make sure to change "1" to the ...

  14. How to Diskpart Erase/Clean a Drive Through the Command Prompt

    This is the Command Prompt window. From the command prompt, type diskpart and press Enter. The diskpart prompt will open. From the diskpart prompt, type list disk and press Enter. A list of disks will appear in a text format. You will return to the diskpart prompt. Step one verified that Disk 1 is the 3TB drive.

  15. create partition primary

    For master boot record (MBR) disks, you must specify a partition type byte, in hexadecimal form, for the partition. If this parameter isn't specified, the command creates a partition of type 0x06, which specifies that a file system isn't installed. Examples include: LDM data partition: 0x42. Recovery partition: 0x27.

  16. Manually assigning a drive letter using CMD/Diskpart

    Procedure Open up a command prompt (CMD/PowerShell). Type "diskpart" to start up diskpart. You will see the prompt change to "DISKPART>". Type "list vol" to list all available volumes. You can identify the drive by size and file system. Additionally, the volume doesn't currently have a drive letter. Select the volume using "sel vol <number>".

  17. How to Make a Bootable USB Flash Drive Using Diskpart

    Go to the Command Prompt. Select Start and type CMD in the search field, right click on CMD.exe and select Run as administrator. Alternatively, go to Start > All programs > Accessories > right click on Command Prompt and select Run as administrator. A User Account Control (UAC) dialog Window may appear. Click Yes to Continue.

  18. Diskpart Command in Windows

    Type diskpart, after pressing Windows+R Keys and clicking on ok. In the DiskPart command Window, type list disk and hit Enter This will list all the available drives with a number specified to them starting from 0. If you want to see all the volumes then type list volume and hit Enter.

  19. How to Create Volume/Partition Using Diskpart? [Full Guide]

    Step 1: Open CMD on your Windows computer. Step 2: Enter diskpart and then Type list disk. Step 3: Select a disk using the select disk x command. (Replace x with the number of the disk you wish to select) Step 4: Type the command create partition primary size=20480 to initialize a new partition with a size.

  20. DiskPart to assign drive letters via Command Prompt

    1. Open a command prompt 2. Type in diskpart 3. Type list disk to see a list of disks 4. Type select disk # (where # is the disk you want) 5. Type detail disk to see partitions 6. Type select...