New
#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:
If you look in File explorer you will see this: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>
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:
So, note that performing a "cd d:" from a command prompt does NOT fail, however, performing a "cd d:" DOES fail.Code:C:\>cd d: D:\ C:\>cd d:\ The parameter is incorrect. C:\>
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?