Why does a flash drive with no partitions show a drive letter?

Page 1 of 2 12 LastLast

  1. Posts : 4,187
    Windows 11 Pro, 22H2
       #1

    Why does a flash drive with no partitions show a drive letter?


    Windows 10

    I've run into something interesting that I cannot explain:

    Suppose that you select a flash drive in Diskpart and perform a "clean" on it. In theory, all partitions are wiped out and we should have a completely blank disk. However, diskpart still shows a drive letter associated with the volume which is shown with a status of "Unusable".

    Here is an example:

    Code:
    DISKPART> select disk 1
    
    Disk 1 is now the selected disk.
    
    DISKPART> clean
    
    DiskPart succeeded in cleaning the disk.
    
    DISKPART> detail disk
    
    SanDisk Extreme Pro USB Device
    Disk ID: 34389D00
    Type   : USB
    Status : Online
    Path   : 0
    Target : 0
    LUN ID : 0
    Location Path : UNAVAILABLE
    Current Read-only State : No
    Read-only  : No
    Boot Disk  : No
    Pagefile Disk  : No
    Hibernation File Disk  : No
    Crashdump Disk  : No
    Clustered Disk  : No
    
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 3     D                       Removable       0 B  Unusable
    
    DISKPART>
    If you look in File explorer you will see this:

    Why does a flash drive with no partitions show a drive letter?-image1.jpg

    This behavior was causing a problem for me because I had some code that was trying to find the first available drive letter. The code would rely upon the fact that trying to perform certain operations on a non-existant drive letter would result in an an error. However, in this case , the code was not failing when it tried to access the D: drive. Here is an example:

    Code:
    C:\>cd d:
    D:\
    
    C:\>cd d:\
    The parameter is incorrect.
    
    C:\>
    So, note that performing a "cd d:" from a command prompt does NOT fail, however, performing a "cd d:" DOES fail.

    The nature of my code was such that the failure mode was not at all obvious and it took me about 2 and a half hours to find that this was the culprit. The fix was the addition of a single backslash to my code. Doh!

    It's worth noting that this same behavior occurs for all removable media, but not hard disks.

    In any case, my question is simply this: Why on earth do removable disks with no partitions have a drive letter assigned to them but fixed disks do not?
      My Computers


  2. Posts : 12
    Windows 10 Pro N 64 20H2 (Build 19042.685)
       #2

    hsehestedt said:
    In any case, my question is simply this: Why on earth do removable disks with no partitions have a drive letter assigned to them but fixed disks do not?
    Technically, I don't have an answer.

    But *logically*...removable media has to be able to be interacted with by the user: mounted, formatted, etc. How are they going to do that if it isn't available in some fashion through the operating system? This is something that's going to happen a lot -- it's removable, portable media. And for ease of use, slotting it into the existing paradigm of storage devices, i.e., assigning it a drive letter, causes much less friction for the user.

    Does it make things wonky for scriptors and programmers? Sure. But I think this is the right choice from a usability perspective.

    IMHO, and FWIW. :)
      My Computer


  3. Posts : 4,187
    Windows 11 Pro, 22H2
    Thread Starter
       #3

    Good thought, but I should have mentioned that I already know that this is not the case. Take a look at the following example of what happens if you try to interact with the drive through that drive letter in File Explorer:

    Why does a flash drive with no partitions show a drive letter?-1.jpg
    Why does a flash drive with no partitions show a drive letter?-2.jpg

    So you have to partition it using Disk Manager, Diskpart, etc. just as you would with a HD.

    I know that I can remove the drive letter, but I'm surprised that one even exists after a "clean" in diskpart.
      My Computers


  4. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #4

    Hello @hsehestedt,

    Does the same apply if you actually assign it a drive letter, in Diskpart as part of the Clean operation?

    > How to Change and Assign Drive Letter in Windows 10
    > Remove Drive Letter in Windows 10

    I hope this helps.
      My Computer


  5. Posts : 12
    Windows 10 Pro N 64 20H2 (Build 19042.685)
       #5

    hsehestedt said:
    So you have to partition it using Disk Manager, Diskpart, etc. just as you would with a HD.
    Huh...confirmed and all. That is odd. The drive letter is reserved, too: if you try to create a new simple volume with Disk Manager, whatever drive letter the "cleaned" drive has been assigned is unavailable.

    As a side note, PowerShell does not have the same problem recognizing the drive letter as unavailable that cmd.exe does -- a "cd" to the drive letter with or without the backslash errors out.
      My Computer


  6. Posts : 1,524
    Win10 Pro
       #6

    hsehestedt said:
    Windows 10

    I've run into something interesting that I cannot explain:

    Suppose that you select a flash drive in Diskpart and perform a "clean" on it. In theory, all partitions are wiped out and we should have a completely blank disk. However, diskpart still shows a drive letter associated with the volume which is shown with a status of "Unusable".

    Here is an example:

    Code:
    DISKPART> select disk 1
    
    Disk 1 is now the selected disk.
    
    DISKPART> clean
    
    DiskPart succeeded in cleaning the disk.
    
    DISKPART> detail disk
    
    SanDisk Extreme Pro USB Device
    Disk ID: 34389D00
    Type   : USB
    Status : Online
    Path   : 0
    Target : 0
    LUN ID : 0
    Location Path : UNAVAILABLE
    Current Read-only State : No
    Read-only  : No
    Boot Disk  : No
    Pagefile Disk  : No
    Hibernation File Disk  : No
    Crashdump Disk  : No
    Clustered Disk  : No
    
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 3     D                       Removable       0 B  Unusable
    
    DISKPART>
    If you look in File explorer you will see this:

    Why does a flash drive with no partitions show a drive letter?-image1.jpg

    This behavior was causing a problem for me because I had some code that was trying to find the first available drive letter. The code would rely upon the fact that trying to perform certain operations on a non-existant drive letter would result in an an error. However, in this case , the code was not failing when it tried to access the D: drive. Here is an example:

    Code:
    C:\>cd d:
    D:\
    
    C:\>cd d:\
    The parameter is incorrect.
    
    C:\>
    So, note that performing a "cd d:" from a command prompt does NOT fail, however, performing a "cd d:" DOES fail.

    The nature of my code was such that the failure mode was not at all obvious and it took me about 2 and a half hours to find that this was the culprit. The fix was the addition of a single backslash to my code. Doh!

    It's worth noting that this same behavior occurs for all removable media, but not hard disks.

    In any case, my question is simply this: Why on earth do removable disks with no partitions have a drive letter assigned to them but fixed disks do not?
    I experienced similar behavior from several flash drives recently. When I tried to create Rescue disks using Macrium the required files failed to completely copy. I tried to reformat them but couldn’t. I tried reformatting in another PC and it appeared to work only to fail to be recognized in the original PC and then the second PC as well. After repeated tries a assumed they were not salvageable and discarded them.
      My Computers


  7. TV2
    Posts : 2,221
    W10 Pro 22H2
       #7

    What happens if you use the Diskpart Clean All command?

    Erase Disk using Diskpart Clean Command in Windows 10
      My Computers


  8. Posts : 4,187
    Windows 11 Pro, 22H2
    Thread Starter
       #8

    SoFine409 said:
    I experienced similar behavior from several flash drives recently. When I tried to create Rescue disks using Macrium the required files failed to completely copy. I tried to reformat them but couldn’t. I tried reformatting in another PC and it appeared to work only to fail to be recognized in the original PC and then the second PC as well. After repeated tries a assumed they were not salvageable and discarded them.
    Nooo! If that happens to you again, post a message here. I think that I could help you recover such drives.
      My Computers


  9. Posts : 4,187
    Windows 11 Pro, 22H2
    Thread Starter
       #9

    TV2 said:
    What happens if you use the Diskpart Clean All command?
    Have not tried that mainly because of the time involved to wipe every byte of the disk. Besides, I've found now that I can simply remove the drive letter assignment so it's now simply a question of why a standard "clean" leaves behind a drive letter assignment for an unusable volume.
    @Krieger - thanks for noting your results using powershell. Interesting that this behaves differently that a standard command prompt where a CD X: does not generate an error but a CD X:\ does result in an error.
      My Computers


  10. Posts : 1,524
    Win10 Pro
       #10

    hsehestedt said:
    Nooo! If that happens to you again, post a message here. I think that I could help you recover such drives.
    Thanks, I’ll do that.
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 05:53.
Find Us




Windows 10 Forums