diskpart assign drive letter cmd

Top Contributors in Windows 11: Ramesh Srinivasan  -  neilpzz  -  Kapil Arya MVP  -  _AW_  -  Horace Wiggins   ✅

February 14, 2024

Top Contributors in Windows 11:

Ramesh Srinivasan  -  neilpzz  -  Kapil Arya MVP  -  _AW_  -  Horace Wiggins   ✅

  • Search the community and support articles
  • Search Community member

Ask a new question

LightJack05

  • Article Author

Manually assigning a drive letter using CMD/Diskpart

[Localization from this article: Manuelles Zuweisen eines Laufwerksbuchstaben mit CMD bzw. Diskpart - Microsoft Community ]

Technical Difficulty: Expert

Applies to: Windows 10 & 11

In some cases, Windows will not assign a drive letter automatically to an inserted drive. For example, this can happen when using a Windows installation media.

In that case, you can use diskpart to manually assign a drive letter.

NOTE: If your drive doesn't get assigned a drive letter, even though you are in a normal Windows environment, this can indicate a problem with the drive. Please back up your files in that case.

Open up a command prompt (CMD/PowerShell).

Type "diskpart" to start up diskpart. You will see the prompt change to "DISKPART>".

diskpart assign drive letter cmd

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.

diskpart assign drive letter cmd

Select the volume using "sel vol <number>".

diskpart assign drive letter cmd

Assign the drive letter using "assign letter=<letter>".

diskpart assign drive letter cmd

You can now exit diskpart by typing "exit" and switch to the drive using "<letter>:".

diskpart assign drive letter cmd

It should also be available from Windows Explorer now.

50 people found this helpful

  • Subscribe to RSS feed

Was this article helpful? Yes No

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this article?

Thanks for your feedback, it helps us improve the site.

Thanks for your feedback.

Comments (17) 

* Please try a lower page number.

* Please enter only numbers.

Joe13 B-) 2.0

Thanks for the tutorial, I don't think I need to use Google for it anymore!

Congrats on Article Author too! :)

Report abuse

6 people found this comment helpful

Was this comment helpful? Yes No

How satisfied are you with this comment?

Thanks for the tutorial, I don't think I need to use Google for it anymore! Congrats on Article Author too! :)

5 people found this comment helpful

Thanks! Happy I could help! :)

1 person found this comment helpful

RAJU.MSC.MATHEMATICS

Very helpful Thanks.

3 people found this comment helpful

Thank for this informative article.

I ran this in PowerShell PS C:\WINDOWS\system32> GWMI -namespace root\cimv2 -class win32_volume | FL -property DriveLetter, DeviceID

The results are below. I need to know more about the DriveLetter, that does not have a letter and I cannot give it a letter, as you can see in DiskPart.

I'm sure someone personally hacking my computer. I'm wondering if this them hiding on it, and that is why I someone is typing over me and has more control at times of my computer then I do. Maybe a hidden AD Hoc.

I have searched for this on Google I'm either getting blocked or there is no information out there on this.

PS C:\WINDOWS\system32> GWMI -namespace root\cimv2 -class win32_volume | FL -property DriveLetter, DeviceID

DriveLetter : B:

DeviceID : \\?\Volume{26xxxxxx--xxxx-xxxx-xxxxxxxxxxxxxx}\

DriveLetter : C:

DriveLetter :

DeviceID : \\?\Volume{d5xxxxxx--xxxx-xxxx-xxxxxxxxxxxxxx}\

DriveLetter : D:

PS C:\WINDOWS\system32> DiskPart

Microsoft DiskPart version 10.0.19041.1

Copyright (C) Microsoft Corporation.

On computer: My Computer

DISKPART> List Volume

Volume ### Ltr Label Fs Type Size Status Info

---------- --- --- -------- ----- ---------- ------- --------- --------

Volume 0 D RAW DVD-ROM 2048 B Healthy

Volume 1 B System Rese NTFS Partition 100 MB Healthy System

Volume 2 C NTFS Partition 698 GB Healthy Boot

2 people found this comment helpful

I followed the instructions to CHANGE the letters assigned for three external hard drives. (The computer had named them E, F, G but gave the names to the wrong external hard drive) I changed the letters to the correct names singly (I disconnected the two not being adjusted) Now, I have 2 E, 2 F, 2 G names in the list (when accessed through File Explorer. When I click on "This PC", it shows just the one of each. If I click on either, or both of the same letter name, the same exact files will open. This is annoying. Anyone have a clue what can be done? This is on a brand new computer running Windows 11.

Sorry about the late reply.

That sounds weird... Usually, windows doesn't allow you to assign a drive letter twice.

If you want to change the letters, you usually have to remove them first and then reassign them.

Can you send me a screenshot of disk management, and of the list of volumes?

the partition that is not shown in diskpart is most likely some sort of recovery or reserved partition.

This is not the typical way of hiding an infection with malware...

Also, do note that your ESP (Volume B) should not be mounted, since modifying it can corrupt your Bootloader.

As for the suspected hacking, what symptoms did you observe? Mouse moving on its own, high resource usage, unexpected firewall prompts? Other things?

If you have a compromised system, its almost impossible to clean it from infections without doing a clean install of windows. I would suggest you do that if you suspect an infection. It will take time though and will delete everything on your PC. (Including files, programs, settings.) Create a backup before you reinstall.

There are no viruses nor malware on this computer. I believe it is a reflection of the original name choice. The information contained on each external hard drive is identical, yet when I go into MY PC, it only shows one set of externals. I am afraid to delete one of the duplicates because it might be just mirrored and it will make everything go away. I have way too many things on these external hard drives to lose any of them.

Thanks for your input. Jan

Forum Article Info

  • Devices and drivers
  • Norsk Bokmål
  • Ελληνικά
  • Русский
  • עברית
  • العربية
  • ไทย
  • 한국어
  • 中文(简体)
  • 中文(繁體)
  • 日本語

How-To Geek

How to use the diskpart utility to assign and remove drive letters.

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.

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.

diskpart assign drive letter cmd

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.

diskpart assign drive letter cmd

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.

diskpart assign drive letter cmd

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.

diskpart assign drive letter cmd

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.

diskpart assign drive letter cmd

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

How to Remove and Assign Drive Letters in Windows with Diskpart

Vamsi Krishna

Diskpart is one of the most powerful Windows command line utilities which first appeared in Windows XP. Diskpart is mainly used by Windows administrators to manage tasks like partition management, formatting, creating, re-sizing and getting a detailed information regarding the hard disk or other removable disks attached to the computer. Even though you have a built-in GUI application called Disk Management utility in Windows, Diskpart is much more flexible and works well in a server environment where you need to set up some advanced features like RAID.

Note: This post isn’t intended for beginners, and doing something wrong while using Diskpart utility may cause drive failures and data losses, so make sure that you have a good backup before continuing. You have been warned.

Assign Drive Letter Using Diskpart

Assigning a new drive letter to a partition or removable device using Diskpart is really easy. First, search for the command prompt in the Start menu, right click on it and select the option “Run as administrator.” If you are using Windows 8, press “Win + X” to open the power user menu and select the option “Command Prompt (Admin).”

diskpart-launch-cmd-as-admin

The above action will open the command prompt window with administrative rights. Here enter the following command to start the Diskpart utility.

diskpart-cmd-diskpart

The next step is to list all the volumes in your computer so that you can clearly see all the volume numbers and drive letters of your hard disk partitions and any other removable devices. Use the command below to list all the volumes.

diskpart-list-volume

Once the Diskpart utility lists all the volumes, take a note of the volume number of the drive you want to assign a new drive letter. In my case, I’m trying to assign a new drive letter to the drive I:\ , so my volume number is 7 . Now execute the following command to select the volume while replacing the # symbol with an actual volume number.

diskpart-select-volume

Once the volume is selected, use the following command to assign a new drive letter. Don’t forget to replace the letter “V” with the drive letter you want to assign.

diskpart-assign-letter

That’s all there is to do; you have successfully changed or re-assigned a new drive letter to a partition or a removable drive in Windows. In fact, if you open the Windows explorer, you can see that the change is reflected immediately.

diskpart-drive-letter-changed

Remove Drive Letter using Diskpart

Before moving any further, removing or un-assigning drive letter will effectively hide the drive or partition from plain sight, i.e. you cannot see that drive in the Windows explorer. To remove a drive letter, follow the above steps 1 through 4 and then use the below command to remove the drive letter of a drive or partition. Don’t forget to replace the letter “I” with the actual drive letter.

diskpart-remove-letter

As soon as you have done that, Diskpart will remove the drive letter for that volume. If you list the volumes again, you will see that the drive you just interacted with will have no drive letter next to it.

diskpart-letter-removed

Moreover, if you navigate to the Windows explorer, you will see that the drive which got un-assigned isn’t listed anymore. But again, always be careful while you are messing around with Diskpart utility; it may cause irrecoverable data loss if used incorrectly.

Hopefully that helps, and do comment below if you face any problems while following the steps or to simply share your thoughts.

Our latest tutorials delivered straight to your inbox

Vamsi Krishna

Vamsi is a tech and WordPress geek who enjoys writing how-to guides and messing with his computer and software in general. When not writing for MTE, he writes for he shares tips, tricks, and lifehacks on his own blog Stugon.

Wsl Neofetch

This browser is no longer supported.

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

  • 10 contributors
Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012

Assigns a drive letter or mount point to the volume with focus. You can also use this command to change the drive letter associated with a removable drive. If no drive letter or mount point is specified, the next available drive letter is assigned. If the drive letter or mount point is already in use, an error is generated.

A volume must be selected for this operation to succeed. Use the select volume command to select a volume and shift the focus to it.

You can't assign drive letters to system volumes, boot volumes, or volumes that contain the paging file. 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.

To assign the letter E to the volume in focus, type:

Related links

Command-Line Syntax Key

select volume command

Submit and view feedback for

Additional resources

  • Test Automation
  • Performance Testing
  • Cyber Security Testing
  • ETL Testing
  • Multilingual NLP Assurance
  • Mobile App and Web Testing
  • IV&V and Regulatory Assurance
  • PoS Testing
  • Accessibility Testing
  • Service Virtualization
  • XR Assurance
  • Digital Assurance
  • Cloud Migration Testing
  • IoT Assurance
  • Drone Assurance
  • Storm Readiness Testing
  • Real-Time Systems
  • Test Environment Management
  • Testing of AI
  • Other ERP Packages
  • Google Cloud
  • AI Data Services
  • Mobile and Web Dev
  • DevOps Transformation
  • Serverless Cloud Native Development
  • Cloud Transformation and Migration Strategy
  • API Integration Services
  • Business AI
  • Modeling Optimization
  • Data Governance Services
  • Learning Platform Development
  • Video Encoding, Streaming and Player Development
  • Instructional Design
  • Content Remediation Services
  • Medical Devices
  • Retail & Consumer Goods
  • Banking & Financial Services
  • Capital Markets
  • Media & Entertainment
  • Managed Testing Services
  • Managed Crowd Testing
  • Project-Based Testing
  • Strategic Consultancy
  • Global Delivery
  • Risk-Based Testing
  • Test.Predictor
  • Test.Consolidator
  • Keysight Technologies
  • White Papers
  • Case Studies
  • Podcast: The Testing Show
  • Technical Hub
  • Categories & Tags
  • Leadership Team
  • Diversity & Inclusion

How to assign a drive a letter using Diskpart

Industries top insights, delivered to your inbox.

Introduction:

Windows volume drive letters can be altered from the command line using Diskpart.

Requirements:

Access to the Windows command line.

From your taskbar, start a search for

Enter the command:

Example output:

but replace “2” with the desired volume number. Enter the command:

but replace the “q” with any desired letter that is not already being used by another volume.

More Information:

within  diskpart  for more information.

New call-to-action

Other Technical Hub

Introduction: CSV files, or comma-separated-files, are used for storing data. They are a very commonly used text file format. Requirements:…

Introduction: Most SQL tables are non-temporary. Temporary tables can be used as well for convenience, or special purposes. Requirements: An…

Introduction: Relational Databases using SQL (Structured Query Language) may have a need for certain operations to be performed, or triggered,…

Want to talk with a test automation expert?

  • Backup & Recovery
  • Hard Disk Manager
  • HFS+ for Windows
  • ExtFS for Windows
  • Disk Wiper Professional
  • Drive Copy Professional
  • Migrate OS to SSD
  • Paragon Alignment Tool Professional
  • NTFS for Mac
  • Hard Disk Manager for Mac
  • ExtFS for Mac

diskpart assign drive letter cmd

Assign, change or remove Drive Letter with Diskpart

Diskpart is very powerful Windows Utility, which allows certain number of operation with hard disk. In this article we will show you how to assign, change or remove drive letter with Diskpart using.

Windows-10-x64-Original-2016-09-05-14-24-29

You bought hard drive for Backup, but it has automaticaly gained letter D . You want to change it to E . First we need to open Command Prompt with Administrator Rights.

Type cmd into the search box, and then right-click and choose Run as administrator. If you have Windows 10 use the CTRL + SHIFT + ENTER keyboard shortcut on Screen 1 , or click on Start with right click and choose Command Prompt (Admin) on Screen 2 .

cp001

When Command Prompt pops up, run the diskpart command.

run_dpt

Now we type list volume to list our volumes, we need to know the number of our volume.

list_vol

In our case our hard drive is Volume 3 and that number is 3 .

Now we use command select volume 3 to make changes to that volume. If your volume number is different, you need to replace number  3 with the number from your volume. After we have selected our volume we use command assign letter E , to assing letter E to our volume.

asn_let

Now you know how to change or assign another letter to your volume, also if you need you can remove volume letter with command remove letter E

rem_let

For security reasons you cannot change or remove your current system disk letter (esp C ), it will not work.

To exit diskpart type in exit .

exit

Enter your email and receive updates about special offers and exclusive content!

Connect with us for giveaways, exclusive promotions and last news!

diskpart assign drive letter cmd

Disk Administration, Partition a disk.

DiskPart can be used to automate disk-related tasks, such as creating volumes or converting disks to dynamic disks. Scripting these tasks is useful if you deploy Windows by using unattended Setup or the Sysprep tool, which do not support creating volumes other than the boot volume.

When using the DiskPart command as a part of a script, we recommend that you complete all of the diskpart operations together as part of a single diskpart script. To run consecutive diskpart scripts, allow at least 15 seconds between each script for a complete shutdown of the previous execution before running the DiskPart command again in successive scripts. Otherwise, the successive scripts might fail. Add a pause between consecutive DiskPart scripts by adding a TIMEOUT /t 15 command to the batch file.

When setting up a new drive, create in this order: Create Partition, Format drive, Assign drive letter.

When selecting a volume or partition, you can use either the number or drive letter or the mount point path.

The Windows GUI interface can also be used to assign a mount-point folder path to a drive. In Disk Manager , right-click the partition or volume, and click Change Drive Letter and Paths , then click Add and then type the path to an empty folder on an NTFS volume.

The Windows Recovery Console , includes a simplified DISKPART command. It only provides functionality for adding and deleting partitions, but not for setting an active partition.

Always back up the hard disk before running DiskPart.

The default SAN policy in Windows Server 2008 / R2 is now VDS_SP_OFFLINE_SHARED for all non boot SAN disks. This means that the disks will be offline at server startup (even if the drive contains a paging file).

This Disk Management error message indicates that the drive is offline:

"the disk is offline because of policy set by an administrator".

Query the current SAN policy to see if it is Offline Shared

DISKPART.EXE DISKPART> san SAN Policy : Offline Shared

To manually bring the disks online: Computer Management ➞ Storage ➞ Disk Management , right-click the disk and choose Online .

If these are not part of a cluster, than an alternative is to make a SAN policy change, select the offline disk, clear its readonly flag and bring it online:

“Divide et impera” ~ Latin saying (Divide and conquer)

Related commands

docs.microsoft.com - Configure UEFI/GPT-Based Hard Drive Partitions using Windows PE and DiskPart. docs.microsoft.com - Configure BIOS/MBR-Based Hard Disk Partitions using Windows PE and DiskPart. FORMAT - Format a disk. FSUTIL - File and Volume utilities. DISKSHADOW - Volume Shadow Copy Service. REAGENTC - Configure Windows Recovery Environment (Windows RE) and System Reset. SYSPREP - (Generalize) a Windows installation. PowerShell equivalents: clear-disk , get-disk, set-partition, get-volume Partition Wizard - GUI Disk Partition Manager. Equivalent bash command (Linux): fdisk - Partition table manipulator for Linux.

More Recovery Products

  • Partition Manager     Partition Master Personal disk manager   Partition Master Enterprise Business disk optimizer   Edition Comparison Partition Master Versions Comparison   Disk Copy Hard drive cloning utility Partition Master Free Partition Master Pro

Centralized Solutions

MSPs Service

Screen Capture

Video Toolkit

Audio Tools

Transfer Products

File Management

iOS Utilities

More Products

  • Support     Support Center Guides, License, Contact   Download Download installer   Chat Support Chat with a Technician   Pre-Sales Inquiry Chat with a Sales Rep   Premium Service Solve fast and more

Tutorial on Diskpart Assign Drive Letter in Windows 11/10/8/7 [Detailed Guide]

diskpart assign drive letter cmd

Sherly updated on Jan 11, 2024 | Home > Computer Instruction

On this page, you can learn a detailed guide on Diskpart assign drive letter and a professional alternative to Diskpart:

How can we use Diskpart to assign a drive letter? This article guides you on Diskpart to assign a drive letter and provides a professional alternative to Diskpart, but first, let's learn more about Diskpart.

What Is Diskpart

Diskpart  is a free command line utility that handles Windows OS commands to perform many disk partitioning tasks via different command lines. It was introduced in Windows 2000 and is the successor to fdisk. As it was introduced, Diskpart is a disk partitioning utility that helps experienced professional Windows users manage their storage devices. 

diskpart interface

As you know, Windows assigns drive numbers to all available drives on the computer, such as optical drives, internal hard drives, SD cards, and external USB drives. A drive letter is a letter identifier for one volume, and each drive letter can be used once on the computer.

And some users with computer experience may assign drive numbers via  Diskpart commands . So next, let's see how we can use Diskpart to assign a drive letter.

Full Guide on Diskpart Assign Drive Letter - Complex

Diskpart is a command line tool that allows you to quickly manage disks or partitions from a command prompt. It can create, delete, extend, or shrink a partition. But how to assign a drive letter via Diskpart? Next, I will show you how to use Diskpart to  change drive letter .

Step 1.  Press Windows + S at the same time to run the search box. Then type cmd. When the command prompt window appears, right-click it and choose "Run as administrator."

Step 2.  Type  diskpart  in the command prompt windows and press Enter.

Step 3. Then, type the following commands, and don't forget to press Enter after you type one command:

  • list volume
  • select volume 4 (Replace 4 with the correct number)
  • assign letter=H

cmd assign drive letter

In this way, you can assign a drive letter to your partition and still use Diskpart commands to extend a partition or delete a partition. However, sometimes you may encounter problems, such as " Diskpart failed to extend the volume " or"Diskpart  can't change drive letter ."

So, to avoid these errors, a professional disk management tool is needed to help you, EaseUS Partition Master. Next, let's see how it helps us.

Professional Alternative for Diskpart Assign Drive Letter - Easy

Diskpart is not perfect because it has limitations. Fortunately, there is a simpler way to perfectly compensate for their shortcomings.

EaseUS Partition Master Professional is a utility third-party partition manager. It supports users in assigning disk partitions through a clear interface that can be finished with just a few clicks. And it is much easier than Diskpart. Moreover, it can assign drive numbers on various  file system types . What's more, it is more functional and allows you to manage your disks. Now, download it and follow the guide to assign a drive letter via EaseUS Partition Master.

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

Step 1.  Run EaseUS Partition Master, right-click the target partition, and choose "Change Drive Letter".

Step 2.  In the new window, click the down arrow and choose a drive letter for the partition from the drop-down menu, then click "OK".

Step 3.  Click the "Execute 1 Task(s)" button in the top-left corner, check the changes, and click "Apply" to change the drive letter of the selected partition.

Besides, it can do far more than assigning a drive letter. So now, let's learn more features about it.

Features of EaseUS Partition Master:

  • Resize disk partitions
  • Create or delete partitions
  • Split or  merge partition on SSD
  • Move unallocated space to C drive
  • Assign drive letters on various file system
  • Windows 11/10/8.1 and  Windows 7 extend partition

Hence, download EaseUS Partition Master to help you to solve any problems with your  disk partition . Its clear interface will make it easy to use, so don't worry and download it to help.

Do you know how to use Diskpart to assign drive letters? This part provides two ways to assign a drive letter. If you are a user with a lot of computing experience, Diskpart is probably the fastest way to assign disk characters. However, if you are a normal user or don't know much about computer operation, EaseUS Partition Master is the right choice. 

You may like the following content:

By the way, the next part shows several questions related to Diskpart. Continue to read if you would like to learn more.

Diskpart Assign Drive Letter FAQs

You have learned to use Diskpart to assign a drive letter and a professional alternative to Diskpart. This paragraph shows you several frequently asked questions. If you have similar problems, continue to read.

1. How do I assign a drive letter without formatting?

First, open Diskpart by typing diskpart in the Command Prompt window.

Then, type the following commands in the Diskpart window:

  • select volume 1

Remember to hit enter each time you type a command and replace one and H with the correct number and the letter you like.

2. What does diskpart assign do?

Diskpart can assign a drive letter to your volume. If you want to change the drive letter or the original drive letter doesn't work, you can use Diskpart commands to assign a new drive letter.

3. Can I assign drive letter B?

No, you can't. Letter A and letter B are for floppy drives. And the letter C is usually for the system partition. So you can choose a letter from D to Z for your drive.

Was This Page Helpful?

diskpart assign drive letter cmd

Updated by Daisy 

Daisy is the Senior editor of the writing team for EaseUS. She has been working at EaseUS for over ten years, starting as a technical writer and moving on to being a team leader of the content group. As a professional author for over ten years, she writes a lot to help people overcome their tech troubles.

Read full bio

diskpart assign drive letter cmd

Written 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. She has written over 200 articles to help people overcome computing issues.

Related Articles

Fix Error Code 1309 Mac [2024 Guide]

author icon

Low Level Format VS Standard Format, What's the Differences and Which to Use?

9 Best Solutions to Fix Windows Stop Code 0xC000021A

author icon

10 Fixes to Solve Chromebook Black Screen [2024 Guide]

author icon

EaseUS Data Recovery Services

Request a free evaluation >>

EaseUS data recovery experts have uneaqualed expertise to repair disks/systems and salvage data from all devices like RAID, HDD, SSD, USB, etc.

diskpart assign drive letter cmd

Copyright ©   EaseUS. All rights reserved.

How to Format a Hard Drive Using the Command Prompt

Formatting one of the best hard drive s or SSDs is the same as buying a new hard drive since the process erases all the data in one fell swoop. When you format your hard drive, you can clean internal as well as external storage media.

In this tutorial, we explain how you can format a hard drive using the command prompt. Before proceeding further, make sure you backup all available data to prevent data loss. Follow the steps below to format a drive:

STEP 1:    Open Command Prompt As Administrator

Search for command prompt, right click and run as Administrator.

STEP 2:    Use Diskpart

Once command line is open, type ' diskpart ' and press Enter.

STEP 3:    Type List Disk

The above command will open a Diskpart window. In this window, type ' list disk ' and press Enter. It will list all the available drives.

STEP 4:    Select the Drive to Format

Now type ' select disk (disk number) ' as shown above. Specify the drive number which needs to be formatted.

STEP 5:    Clean the Disk

In this step, type ' clean '. This command will permanent delete all files and folders, and successfully clean up the disk.

STEP 6:    Create Partition Primary

To make the drive again accessible, type ' create partition primary '.

STEP 7:    Format the Drive

Now format the drive with FAT or NTFS file system. Type ' format fs=ntfs ' and press Enter.

STEP 8:    Assign a Drive Letter

To assign a drive letter, you can type ' assign ' as shown below.

MORE: How to Enter the BIOS on Any PC

MORE: Windows How-To Articles

Stay on the Cutting Edge

Join the experts who read Tom's Hardware for the inside track on enthusiast PC tech news — and have for over 25 years. We'll send breaking news and in-depth reviews of CPUs, GPUs, AI, maker hardware and more straight to your inbox.

New HAMR lasers could usher in 30TB+ HDDs, Seagate and Sony team up for production: Report

Hard drive density advances face diminishing returns — 30TB+ drives gain just 6.6% capacity with SMR: Report

Nvidia Grace Hopper Superchip poised to push the boundaries of quantum computing in Australia

  • ehmkec Am I missing something? Couldn't you just bring up a command prompt and type "format e:" - or some other drive letter? Reply
  • tcaster6263 would be kind of short for a tutorial don't you think? Reply
  • polomint Or use Computer Management -> Disk Management if you want to remove all partitions on a drive then format it... Reply
21240634 said: Am I missing something? Couldn't you just bring up a command prompt and type "format e:" - or some other drive letter?
21240861 said: 21240634 said: Am I missing something? Couldn't you just bring up a command prompt and type "format e:" - or some other drive letter?
21240932 said: 21240861 said: 21240634 said: Am I missing something? Couldn't you just bring up a command prompt and type "format e:" - or some other drive letter?
  • USAFRet Wh y you need to do this dictates how you do this. Reply
  • jpe1701 I agree with USAFRET. I've had disk management just not let me format a drive and I had to use diskpart to get it done. Heck I've even used Ubuntu on a bootable drive to do disk management many years ago just because I knew the Linux commands and not the windows. Reply
  • stdragon It's useful when installing Windows 10 on a used drive. But it's not a secure erase. So long as you know that, then proceed. Reply
  • View All 21 Comments

Most Popular

By Sammy Ekaran December 24, 2023

By Sammy Ekaran December 23, 2023

By Les Pounder December 10, 2023

By Les Pounder December 05, 2023

By Sammy Ekaran December 04, 2023

By Sammy Ekaran December 02, 2023

By Sammy Ekaran November 06, 2023

By Sammy Ekaran November 05, 2023

By Les Pounder November 04, 2023

By Sammy Ekaran November 03, 2023

By Sammy Ekaran October 29, 2023

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Diskpart assign letter to partition that is not associated with a volume (windows 10)

I used to have 3 volumes on my disk before something happened to the MBR that messed up my boot.

Now i'm trying to rebuild the boot environment to save all my data but it seems it is all lost. I can see the data through the command promt (from windows 10 DVD)

I am trying to do bcdboot c:\Windows /m {guid} but it is not working

I have also run:

I can find a lot of information on how you assign a drive-letter to a volume, but not how to assign a drive letter to a partition or make a partition associated with a volume.

When selecting the partition through diskpart i 'detail' part tells me: "There is no volume associated with this partition." so i am thinking there must be a way to asscociate it with a volume. but how?

How do i proceed to recover the boot?

  • partitioning

Leo Chapiro's user avatar

  • 1 >UDF DVD-ROM 3894 MB healthy <- (this is where my 128MB boot part used to be) ? But this seems to be a DVD-ROM ? –  Leo Chapiro Sep 25, 2015 at 13:24
  • Yes, but vol 0 used to be the boot part, the dvd was probably vol 3 –  fjoesne Sep 25, 2015 at 13:26
  • I cannot rebuildbcd or run bcdboot so that windows 10 is functional again. The problem (i think) is that i cannot run bcdboot nor rebuildbcd because the part where the boot is supposed to be installed has no volume. –  fjoesne Sep 25, 2015 at 13:29
  • By deleting the first (boot) partition and recreating it I was able to create a volume and I was eventually able to make a new BCD manually with bcdedit and bootsect. However, it seems to make no difference what I do to the BCD on the partition because windows boots no matter what now. However the boot is only possible by choosing the UEFI-element as listed in the BIOS, this was not visible before I deleted and recreated the boot-partition. I am still not able to run bootrec /rebuildbcd and get the same error as before. I think the problem now is that the partion and volume type is wrong.(?) –  fjoesne Sep 26, 2015 at 23:08

3 Answers 3

I ran into the same issue after using gparted and ntfsclone . diskpart> list partition shows all my partitions, but they don't listed in diskpart> list volume and not associated with an letter.

Find out which partition X you need to associate with an letter:

If your disk has GPT table, set partition type GUID as Microsoft basic data partition (corresponding gdisk partition type is 0700 ):

If your disk in MBR ( 07 = Windows NT NTFS; 17 = Hidden; 27 = OEM Recovery):

Now you can try diskpart> list partition again. bcdboot c:\Windows worked for me just fine.

radioxoma's user avatar

  • 2 This should be the accepted answer. I had the same problem as the original poster and followed these instructions. My EFI partition had also become hidden and this fixed it. I could then follow these instructions to Rebuild the Window BCD bootloader configuration –  FlexMcMurphy Oct 31, 2021 at 21:25
  • 1 thanks, you saved my hours! –  Özgür Apr 5, 2022 at 23:49
  • Following this through to set id=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 worked for me, and immediately mounted the drive in Windows. Can't figure out why this worked or was was needed... –  sblair Oct 30, 2022 at 16:26

Goodness sake, be careful!

It sounds like not "all is lost", but it also sounds like you only vaguely know what you're doing, and are proceeding. That is a recipe for "all is lost".

To elaborate, it sounds like you're able to access the vast majority of your data, but you're having troubles booting, which is a much simpler fix overall. But if you're not careful, you could easily lose the vast majority of your data.

First, it will help to make sure you know some basic terminology. The MBR is the first sector on a disk. The "MBR"-style of laying out partitions can handle drives up to 2 TB, and it looks like you're dealing with a drive smaller than that, so you might indeed be using an MBR and not the newer GPT format.

The two main jobs of an MBR are to have some initial boot code (instructions that the computer follows), and having 64 bytes of information to store details for up to 4 partitions (each partition table entry is 16 bytes).

Those 64 bytes of information can be pretty important. If you get some of these details wrong, operating systems may not properly understand some details about your partitions. And since operating systems typically write to disks, such misunderstandings can result in writing incorrect details that damage your ability to access data. So, being careful here is pretty critical.

A "partition" is basically a set of boundaries. You specify the starting sector, and either the ending sector or the size. Either way, you get a starting boundary and an ending boundary.

A "volume", sometimes called a "filesystem", stores your actual data. A volume needs to exist within the boundaries of the partition.

Now what typically happens is that an operating system looks at a partition, and assumes that a volume starts right at the beginning of the partition. Also, the partition specifies a "type", which is meant to be a strong clue about which style of volume is being used.

If the operating system can't find the volume, there are multiple possible reasons. One is that the partition's starting sector is wrong, and so the start of the volume isn't being properly found. Another possibility is that an improper "type" is being used, so the operating system doesn't know how to interact with the volume it is using. Another possibility is that the volume is damaged, and so the operating system is unable to find a volume that matches some details that the operating system checks for.

On my system, which is using GPT and that might cause some slight but significant differences, the "System" drive is the small drive (under a gigabyte), and my important data is stored on the large partition which shows up as a "Primary" type. The "System" type is not assigned a drive letter (although that isn't too hard, or problematic, to change... I would recommend assigning it a high drive letter, like S:, rather than C: or slightly higher. I also recommend avoiding X: since I think the Windows boot disk likes to use that.)

Since your System volume isn't even showing up, to me that suggests that it is damaged. You might need to restore that, providing a fresh copy of the boot files. This might not be something as easy to fix as using BCDEdit, which basically just tries to make slight changes. Your best bet may be to simply re-install the operating system (even to the same drive), which should accomplish a couple of things: placing a fresh (and not-updated) copy of Windows on your hard drive (which may be able to just overwrite, possibly even in-place, your current installation) and adjusting the ability to boot.

There might be an easier/simple way, but I recommend preparing for the possibility that there isn't.

However, I strongly advise you to get a full backup first. If at all possible, I even advise you to not just back up a few files that seem important, but to get a "forensic"/"bit-for-bit" image of the entire drive (onto another drive that is at least as large). That way, you can be comfortable that you're not going to lose your important data while you try to make any changes, and that you can revert in case any attempts go awry.

Having looked over your conversation with GuitarPicker, I am not as worried about your DVD drive showing up as it does. I think that just happens as a result of your boot partition not being detected; if your boot partition were detected, the DVD would automatically be assigned a higher drive letter without a problem. Using SET ID may indeed be helpful (and to find an existing ID, also known as a type, you can SELECT a partition and then say DETAIL PARTITION). But you did say, "I tried again to delete the boot partition with diskpart and recreated it". The problem here is that when you deleted the boot partition, you effectively told the computer to stop keeping track of any data on that partition, such as the critical data used to boot. Then, even if you did create a new partition and volume that are classified as the correct "type" for a boot partition, you still lack that bit of data that is used to boot the operating system. The typical way of getting that data onto a boot drive is called "installing the operating system".

While there might be some way to just transplant such boot data from another computer, some of the data may need to be placed in specific sectors on the volume (a picky detail which is not usually a concern except when dealing with boot files), and so this might or might not be quite as easy as just trying to do a basic copy. In other words, such a transplant has potential for troubles that make this approach not recommended for novices.

Note: I did read your comment about going from Win7 to Win10. You might be okay to just install Win10 over your existing drive, and if you're lucky then maybe your existing licensing might even get preserved, in which case you might not even need to fuss with going through the Windows 7 installation. But, for goodness sake, to make sure you don't introduce yourself to any worlds of new hurt, don't even think of trying that before making your backup. I know that such a task may be an annoyance (especially of money needs to be spent), but I'm re-stressing that issue because sometimes backups are even more worthwhile to make than average, and this is one of those times. So, I strongly advise you to do the wise thing, which is to make that investment in time/energy/supplies before any further mucking.

TOOGAM's user avatar

  • 1 Oh, my. And just now, after posting, I see that the answer was from over three years ago, so my information is probably being supplied way too late for the original poster. –  TOOGAM Jan 5, 2019 at 11:11
  • 1 Which is fine . Remember, answers are for everyone with this same issue, not just the OP. BTW, I think where you said, "operating systems may not properly understand some details about your permissions" you meant permissions . –  I say Reinstate Monica Jan 5, 2019 at 12:25
  • @TwistyImpersonator : Thanks. But I meant partitions :) [that said, I do appreciate the feedback, and have now fixed the sentence you pointed out.] –  TOOGAM Jan 5, 2019 at 12:34
  • 1 Arrg, yes, I did the same thing you did and wrote permissions when I meant partitions ! –  I say Reinstate Monica Jan 5, 2019 at 12:57
  • You may be late to the show, but you already scored more upvotes. Congrats! I like coming back to old answers to see what I used to know. –  GuitarPicker Jan 7, 2019 at 13:57

The partition types seem to be out of whack. Before proceeding, get a good backup with a bit-for-bit backup program like the CloneZilla boot disk, and then try editing the MBR. You didn't specify what type of partition your 128 MB was supposed to be, but you can try setting it manually. If you know what the partition type is supposed to be, you can use DISKPART 's SET ID command to set the hexadecimal partition type manually. Wikipedia has a list of partition types . Common ones are 07 for NTFS, 0C for most FAT32, 06 for FAT.

You may be better off starting with TestDisk , which is made for recovering partition tables. It can automatically detect many types of MBR problems. You still may have to follow through with bcdboot and bootrec, but it should get you to a workable starting point.

GuitarPicker's user avatar

  • Thanks for the tip, I have started a backup to an usb with clonezilla, and i will try to run testdisk either from the win-10 install dvd or my hackintosh install (the install that most likely messed up my window-install in the first-place.) –  fjoesne Sep 25, 2015 at 15:01
  • TestDisk was to no help for me, I guess its "over my paygrade" so to speak because it requires me to do calculations and estimates on what partitions existed before this happened etc. I tried again to delete the boot partition with diskpart and recreated it, but i still can not make it bootable nor can i rebuild the BCD on it. I guess i can save the data with testdisk, but I cannot save the partition table. Since I got the windows 10 upgrade from a windows 7 install i guess i have to install win7 again and go through that nighmare all over :( Ah well thanks for the help anyways.. :) –  fjoesne Sep 25, 2015 at 22:16
  • The MBR is only 512 bytes long (1 block), so it doesn't take much to ruin it. If the other partitions are truly intact, TestDisk should find them. There are sites which run you through the whole process . It bothers me that your DVD drive is drive 0 rather than your hard drive. That could be a contributing factor. Were any cables swapped on the board, or did you update motherboard settings or firmware? –  GuitarPicker Sep 27, 2015 at 2:25
  • 1 Are you confusing drive and vol perhaps? –  fjoesne Sep 27, 2015 at 9:44
  • Yes, I believe I am. –  GuitarPicker Sep 28, 2015 at 1:36

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged hard-drive boot partitioning windows-10 diskpart ..

  • The Overflow Blog
  • Would you trust an AI bot to find the fix for vulnerabilities in your code?
  • Featured on Meta
  • Site maintenance - Saturday, February 24th, 2024, 14:00 - 22:00 UTC (9 AM - 5...
  • Upcoming privacy updates: removal of the Activity data section and Google...

Hot Network Questions

  • Given two sets of integers find an integer in the first set furthest away from all members of the second set
  • On Linux Firefox is listening on several UDP ports on 0.0.0.0
  • Anna and Boris play the Red Blue game
  • Has Biden spent 40% of his presidency on vacation?
  • Why do we bleed at the brake lever and at the caliper in Hydraulic brakes?
  • What does "rob it of a few petrified spars" mean in "Pride and Prejudice"?
  • Am I able to enter Singapore after being denied entry for being in possession of an illegal item?
  • The problem of philosophy?
  • What was the ‘obvious’ new answer to Asimov’s Pâté de Foie Gras made possible by scientific advance?
  • Which form of cross-entropy loss is correct?
  • Couldn't the landlord just say the Thermostat doesn't work when confronted with the temperature being too low?
  • How I can smooth the border that is left after applying "Difference" with a "Mesh Boolean" node?
  • Why is everything based on likelihoods even though likelihoods are so small?
  • Was Alexei Navalny poisoned in 2020 with Novitschok nerve agents by Russia's Federal Security Service?
  • Is there any satellite that uses LOX as oxidizer?
  • Motivation for the definition of curvature of a plane curve
  • Can operators put their satellites to sleep temporarily?
  • If the tidal bulge on the earth speeds the moon up, how does the moon move to a higher orbit?
  • How can Australia can be a member of the Antarctic Treaty while still making a territorial claim in the region?
  • Paintless (raw) aluminium enclosures connected to Earth: Bad practice?
  • Increasing trust in a downloaded binary
  • can gourmet (n.) refer to food?
  • A simple unit test library for C - version II
  • How to not fear the supernatural?

diskpart assign drive letter cmd

The Best Windows Disk Partition Manager and PC Optimizer

diskpart assign drive letter cmd

  • Free Partition Software >

How to Permanently Assign Drive Letter with Ease

A permanent drive letter prevents us from being confused with multiple USB drives. Then, how to permanently assign drive letter with ease? This post offers three effective ways to make it.

Dervish

By Dervish / Updated on November 29, 2023

twitter

Solution #1: Assign a persistent drive letter with Disk Management

Solution #2: assign a static drive letter by command prompt.

Solution #3: Assign drive letter permanently with the best freeware

Why need to permanently assign drive letter?

As we know, Windows assigns drive letters to all the drives that are available on the computer, such as internal hard disks, optical drives, SD cards, and external USB drives. Drive letters are alphabetical identifiers for volumes and each drive letter can be used once on one computer.

However, some users discover USB drive letter keeps changing each time they connect it to the same computer . It happens frequently if they use multiple USB drives on one computer. That’s really frustrating! At this time, assigning permanent drive letters to USB drives is needed.

In addition, some users perform regular backup between the USB drive and the computer via a USB hidden copier . With a persistent drive letter, the backup task can be recognized and repeated by the backup utility smoothly. What we need to do is to permanently assign drive letter.

How to permanently assign drive letter with ease?

How do I permanently set a drive letter? There are three efficient solutions I’d like to recommend to you. Learn how to assign a static drive letter in Windows 10 below:

1. Hit Windows Key + X on your keyboard, and select Disk Management from the menu.

2. Right click the USB drive to which you want to assign a persistent drive letter and select “Change Drive Letter and Paths.”

Change Drive Letter and Paths

3. In the pop-up window, click “Change”.

Select Change

4. In the next window, choose a proper drive letter for your USB drive using the drop-down menu and click “OK”.

Assign Drive Letter

✐ Tips: You may choose a rarely-used drive letter like M-Z, thus avoiding possible drive letter conflicts.

5. You will get a prompt that some programs might rely on drive letters to run properly. Click “Yes” to continue as long as the drive letter you assign here is not occupied by another drive where the programs are installed.

Prompt

1. Tap the Search button on the taskbar and type “cmd” in the search box. Right-click “cmd” and select “Run as administrator”.

2. Type diskpart and press Enter.

3. Type list volume and press Enter.

4. Type select volume # (ex: volume 7) and press Enter to select the USB drive to be assigned a static drive letter. You may get indication from the size of the volume.

5. Type assign letter=# (ex: letter=M) and press Enter to assign a new drive letter.

6. Double type exit and press Enter to exit Diskpart and Command Prompt successively.

Command Prompt

Solution #3: Assign drive letter permanently with the best freeware

AOMEI Partition Assistant Standard , the best partition manager, can help you assign a permanent drive letter to a USB drive. It can be operated with mouse-clicking and it’s totally free. Besides, it offers many other powerful features to help you manage disks and partitions better such as resizing/moving partitions , deleting partitions, formatting partitions, deleting large files , etc.

Just follow the instructions below to see how to permanently assign drive letter:

Step 1. Download, install, and launch AOMEI Partition Assistant. Right-click the USB drive which you want to give a permanent drive letter to, select “Advanced” and then “Change Drive Letter”.  

Change Drive Letter

Step 2. Select a new drive letter in the pop-up window. You are suggested to choose a rarely-used drive letter like M-Z.

Select Drive Letter

Step 3. Click “Apply” to view pending operations and then “Proceed” to commit the operations.

Proceed

✍ Note : To change partition type ID for MBR disk partitions and change serial number on a certain partition, please upgrade to AOMEI Partition Assistant Professional .

You have learned three exact ways to permanently assign drive letters for USB drives. After you commit one of the solutions, every time you connect the same drive to the same computer, Windows 10 will automatically recognize it and set the same letter. However, if you insert your external drive into another computer, it is likely to get a different drive letter. Apart from assigning a drive letter to a certain drive permanently, you can also repair pen drive not detected and fix the error that C drive is RAW with AOMEI Partition Assistant. Go for this tool and you won’t regret!

Dervish

Related Articles

How to assign and remove drive letter with diskpart.

This post will show you how to use Diskpart assign drive letter in Windows 11, 10, 8, 7. In addition, another free GUI software will be introduced to assign or remove the drive letters.

Drive Letter Not Available-Why and How to Solve It?

Can’t assign drive letter in Disk Management because a certain drive letter is not available? Follow this article to solve it efficiently.

How to Change Partition Type ID Easily? (2 Ways Included)

Are you in need of changing partition type ID in Windows? Read this article thoroughly to get two efficient methods to modify partition type ID.

Free Download to Try AOMEI Partition Assistant Now

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

If a drive is causing problems on Windows 10, it could be a logical issue that can be fixed with a few commands.

DiskPart fix drive on Windows 10

  • Fix MBR drive
  • Fix GPT drive

On Windows 10 , you can use the DiskPart tool to resolve virtually any logical problem with a storage drive, and in this guide, I'll outline the steps that I typically use to fix most issues (such as data corruption or other logical problems) using DiskPart.

DiskPart is a command-line tool to manage drives, partitions, volumes, and virtual disks through Command Prompt. Usually, it works better than other tools like "Disk Management" and the "Format" feature available on File Explorer.

On Windows 10, you can have different partition styles, including Master Boot Record (MBR) and GUID Partition Table (GPT). The MBR is the legacy partition style for the standard Basic Input/Output System (BIOS). The GPT is a newer partition style, usually found in Unified Extensible Firmware Interface (UEFI) computers. The difference between the two is that GPT is meant to replace MBR since it supports more than four partitions, and it's required on drives with more than 2TB of space. You typically want to use GPT, but MBR is also a good option for external storage. These instructions will help you use DiskPart on either partition style.

These steps will erase everything on the selected drive, and you cannot undo the changes. If the drive is still accessible, it's recommended to back up the data before proceeding. If multiple drives are connected to your device, disconnect them to avoid selecting the wrong one.

In this how-to guide , I will walk you through the steps to use DiskPart to clean and format a hard drive to fix data corruption and other problems on Windows 10.

How to fix drive (MBR) problems with DiskPart on Windows 10

To fix drive issues on Windows 10 with DiskPart, use these steps:

  • Open Start .
  • 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 command to list all the active drives and press Enter : list disk
  • Type the following command to select the drive to clean and press Enter : select disk DISK-NUMBER

In the command, replace "DISK-NUMBER" with the drive number you want to repair as it appears in the "Disk" column. You could erase the wrong drive if you do not perform this step correctly. Proceed with caution.

  • Type the following command to wipe out the drive and press Enter : clean
  • Type the following command to confirm the drive is still selected, and press Enter : list disk
  • Quick note: The output should include an asterisk (*) next to the selected drive. If the correct storage is not specified, perform step 5 again.
  • (Optional) Type the following command to convert the drive to an MBR partition style and press Enter : convert mbr
  • Quick note: This step is only required if the storage is configured as GPT , and you must use MBR partition style. If the partition is already MBR, you don't have to run the command, but running the command won't affect the process. You should be able to determine the partition type with the "list disk" command. If the drive doesn't have a GPT mark (*), it's an MBR partition.
  • Type the following command to create a new partition and press Enter : create partition primary
  • Type the following command to select the new primary partition and press Enter : select partition 1
  • Type the following command to make the partition active and press Enter : active
  • Quick tip: You only have to set a partition as active when using MBR. You can determine if the drive uses an MBR or GPT partition style with the "list disk" command. If the partition has a mark in the GPT column, it's not an MBR partition. If you have to set up a GPT partition style, use the other steps (see below).
  • Type the following command to format the partition using the NTFS file system, set a drive label, and press Enter : format fs=FILE-SYSTEM label=DRIVE-LABEL quick

In the command, replace "FILE-SYSTEM" with the name of the file system to use, such as "NTFS" or "FAT32," and replace "DRIVE-LABEL" with the name of the drive as you want it to appear on File Explorer. The " quick" option isn't required, but it will perform a format faster. However, it's best to skip the option if you are unsure about the drive's condition. The format could take a long time, depending on the hard drive's size. This example formats the drive using the NTFS file system and names the partition "myData": format fs=ntfs label=myData quick

  • Type the following command to assign a letter and make the drive available on File Explorer, and press Enter : assign letter=DRIVE-LETTER

In the command, change "DRIVE-LETTER" for the letter to use on the drive, which is not assigned to another device. This example assigns the "G" letter: assign letter=g

  • Type the following command to terminate DiskPart and press Enter : exit
  • Type the following command to close Command Prompt and press Enter : exit

Once you complete the steps, if the drive does not have physical issues, it should be accessible again through File Explorer.

How to fix drive (GPT) problems with DiskPart on Windows 10

To use DiskPart to fix drive issues with GPT partition style, use these steps:

  • Type the following command to run DiskPart and press Enter : diskpart
  • Type the following command to select the drive you want to clean and press Enter : select disk DISK-NUMBER

In the command, replace "DISK-NUMBER" with the drive number to repair, as it appears in the "Disk" column.

  • Type the following command to confirm the drive is still selected and press Enter : list disk
  • Quick note: The output should include an asterisk (*) next to the selected drive. If the correct storage is not specified, repeat step 5 one more time.
  • Type the following command to convert the partition style to GPT and press Enter : convert gpt
  • Type the following command to format the partition with the NTFS file system, set a drive label, and press Enter : format fs=FILE-SYSTEM label=DRIVE-LABEL quick

In the command, replace "FILE-SYSTEM" with the name of the file system you want to use, such as "NTFS" or "FAT32," and replace "DRIVE-LABEL" with the name of the drive as you want it to appear on File Explorer. The quick option is optional to perform a format faster. However, if you are unsure about the drive's condition, it is best to skip the option. The format could take a long time, depending on the hard drive's size. This example formats the drive using the NTFS file system and names the partition "myData": format fs=ntfs label=myData quick

In the command, change "DRIVE-LETTER" for the letter to use on the drive, which is not assigned to another device. This example sets the "W" letter: assign letter=w

After you complete the steps, the drive should be fixed with a GPT partition style and accessible from File Explorer.

More resources

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

  • Windows 11 on Windows Central — All you need to know
  • Windows 10 on Windows Central — All you need to know

Get the Windows Central Newsletter

All the latest news, reviews, and guides for Windows and Xbox diehards.

Mauro Huculak

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.

  • 2 Alienware Pro Wireless Gaming Keyboard review: Alienware is starting to get REALLY good at this
  • 3 Game the system and buy an Xbox Series X for a lower price than you'll see at GameStop, Amazon, or even Microsoft
  • 4 Razer goes green for gamers with "premium quality, high performance, innovative products" using recycled materials
  • 5 Alienware Pro Wireless Gaming Mouse review: The smoothest mouse I've ever used

diskpart assign drive letter cmd

IMAGES

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

    diskpart assign drive letter cmd

  2. How to Assign and Remove Drive Letter with Diskpart in Windows 10 or 11?

    diskpart assign drive letter cmd

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

    diskpart assign drive letter cmd

  4. How to Remove and Assign Drive Letters in Windows with Diskpart

    diskpart assign drive letter cmd

  5. Change and Assign Drive Letter in Windows 10

    diskpart assign drive letter cmd

  6. Full Guide on Diskpart Assign Drive Letter in Windows 11/10/8/7 [Step

    diskpart assign drive letter cmd

VIDEO

  1. How to Change Drive Letter in Windows 11

  2. How To Format A Drive With Diskpart!

  3. How To Change a Drive Letter Volume with CMD DiskPart ?

  4. How To Change My PC Drive Letter And Paths D,E,F,G,H

  5. How to format and/or assign drive letters using Disk Management in Windows 7

  6. How to Delete Partition or Drive Using CMD (Command Prompt)

COMMENTS

  1. Manually assigning a drive letter using CMD/Diskpart

    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>".

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

    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

  3. How to Remove and Assign Drive Letters in Windows with Diskpart

    If you are using Windows 8, press "Win + X" to open the power user menu and select the option "Command Prompt (Admin)." The above action will open the command prompt window with administrative rights. Here enter the following command to start the Diskpart utility. diskpart

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

    Step 1. Press "Windows + R". Then, type "diskpart" and press Enter. Step 2. Type in "list volume" and press Enter. Now, you can see all volumes on PC. Step 3. Type in "select volume 7" and press Enter (here take volume 7 as an example). Step 4. Finally, type in"assign letter=F" and press Enter.

  5. diskpart

    Windows Commands Command-Line Syntax Key Reference Commands by Server Role append arp assoc at atmadm attrib auditpol autochk autoconv autofmt bcdboot bcdedit bdehdcfg bitsadmin bootcfg break cacls call cd certreq certutil change chcp chdir chglogon chgport chgusr chkdsk chkntfs choice cipher cleanmgr clip cls cmd

  6. assign

    Syntax Examples Related links Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012 Assigns a drive letter or mount point to the volume with focus. You can also use this command to change the drive letter associated with a removable drive.

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

    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...

  8. How to assign a drive a letter using Diskpart

    How to assign a drive a letter using Diskpart Introduction: Windows volume drive letters can be altered from the command line using Diskpart. Requirements: Access to the Windows command line. Procedure: From your taskbar, start a search for cmd Enter the command: diskpart Enter the command: list volume Example output: DISKPART> list vol

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

    2. How to use diskpart to assign a letter to a partition from the Command Prompt or PowerShell. You can and probably want to also assign a letter to the newly created volume. Assigning a letter to a partition makes it visible in File Explorer so that you can easily access it. To assign a letter to a partition use the assign command.

  10. Assign, change or remove Drive Letter with Diskpart

    In this article we will show you how to assign, change or remove drive letter with Diskpart using. You bought hard drive for Backup, but it has automaticaly gained letter D. You want to change it to E. First we need to open Command Prompt with Administrator Rights. Type cmd into the search box, and then right-click and choose Run as administrator.

  11. DiskPart

    By using the assign command, you can change the drive letter associated with a removable drive. You cannot assign drive letters to system volumes, boot volumes, or volumes that contain the paging file. In addition, you cannot assign a drive letter to an Original Equipment Manufacturer (OEM) partition or any GUID Partition Table (gpt) partition ...

  12. Full Guide on Diskpart Assign Drive Letter in Windows 11/10/8 ...

    Step 1. Press Windows + S at the same time to run the search box. Then type cmd. When the command prompt window appears, right-click it and choose "Run as administrator." Step 2. Type diskpart in the command prompt windows and press Enter. Step 3. Then, type the following commands, and don't forget to press Enter after you type one command:

  13. Diskpart

    59 Share 7K views 2 years ago More on the blog: https://bit.ly/31NoF4G Assign drive letters in the command line with Diskpart. Start a command prompt and type "diskpart". Then you can...

  14. How to Format a Hard Drive Using the Command Prompt

    STEP 4: Select the Drive to Format. Formatting a drive. Now type ' select disk (disk number) ' as shown above. Specify the drive number which needs to be formatted.

  15. hard drive

    Diskpart assign letter to partition that is not associated with a volume (windows 10) Ask Question Asked 8 years, 4 months ago Modified 4 years, 2 months ago Viewed 22k times 8 I used to have 3 volumes on my disk before something happened to the MBR that messed up my boot.

  16. How to Manually Assigning A Drive Letter Using CMD / Diskpart

    This Tutorial Helps to How to Manually Assigning A Drive Letter Using CMD / Diskpart00:00 Intro00:09 Open Command Prompt00:20 Enter Diskpart Command00:50 Ass...

  17. How to: Change Volume Label using CMD in Windows 10, 8, 7

    Firstly, press Windows + R at the same time, input cmd, and hit Enter to run Command Prompt as administrator. Then, in CMD interface, type " label f: music " and press Enter key on the keyboard. Notes: ☞ "f" is the drive letter of the drive that you want to rename; it's available to replace music with the name that you want to give to the drive.

  18. How to Permanently Assign Drive Letter with Ease

    Solution #1: Assign a persistent drive letter with Disk Management. 1. Hit Windows Key + X on your keyboard, and select Disk Management from the menu. 2. Right click the USB drive to which you want to assign a persistent drive letter and select "Change Drive Letter and Paths.". 3. In the pop-up window, click "Change". 4.

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

    Type the following command to launch DiskPart and press Enter: diskpart Type the following command to list all the active drives and press Enter: list disk Type the following command to...

  20. How to Assign a Drive Letter using CMD and DiskPart

    🌍The text version of this video: 🔹Use Diskpart Assign Drive Letter in Windows 11, 10, 8, 7🔹How to assign a drive letter in diskpart cmd?🔹How to assign le...

  21. How to Manually Assigning a Drive Letter Using CMD / Diskpart in

    This video helps you to "How to Manually Assigning a Drive Letter Using CMD / Diskpart in Windows 11/10 [Solved] #diskpart"_________________Hash Tags________...