On which physical drive is this logical drive?
I want to understand where logical drives (e.g. C:
, D:
) are mapped on physical drives (e.g. I have a Western Digital and a Toshiba physical disks connected to my laptop).
On Linux, I would do something like:
lsblk
to see the filesystem layout. Then
ls -lh /dev/disk/by-id
to see how filesystems are mapped to physical devices (the ID's usually have the name of the device in them).
How can I achieve something similar in MS Windows? I tried looking in Control Panel → Device Manager, but there's no useful info there. Not in the properties of logical drives either. Googling found me the wmic
utility, but either I don't understand its output or the information isn't there.
The easiest and most obvious way would be to use Computer Management.
Computer Management is located through Start > Control Panel > Administrative Tools > Computer Management
From here, find Storage > Disk Management
Alternatively, you can type diskmgmt.msc
in the Run Dialog or from a Command Prompt.
Diskmanagement gives you the information you requested. All drives, with their partitions, and how they are partitioned.
At the bottom of Disk Management, you'll find a graphical overview of the disks. Rightclicking a disk and choosing properties gives you the information for that specific disk.
If you seek a commandline tool that works similar, then diskpart is what you're after.
WMIC answer:
C:\> wmic diskdrive get index,caption
Caption Index
SAMSUNG HD103SJ 1
C300-CTFDDAC128MAG 2
Samsung SSD 850 EVO 500GB 0
C:\> wmic partition get name,diskindex,index,size
DiskIndex Index Name Size
1 0 Disk #1, Partition #0 1000202043392
2 0 Disk #2, Partition #0 128033226752
0 0 Disk #0, Partition #0 104857600
0 1 Disk #0, Partition #1 499529023488
0 2 Disk #0, Partition #2 471859200
The "DiskIndex" values from the second command line up with the "Index" values from the first command. So you can see that disks 1 and 2 each have a single partition, while disk 0 "Samsung SSD 850 EVO 500GB" has three partitions: two small recovery ones and the main system partition.
Mapping the volumes (C:) etc to partitions seems to be impossible without powershell. See https://stackoverflow.com/questions/4822559/powershell-and-wmi-how-to-map-logical-disk-volumes-to-a-hard-disk-or-vice-versa
You can use PowerShell!
To get the info on a drive from a single partition's drive letter:
Get-Disk (Get-Partition -DriveLetter 'C').DiskNumber
It produces output like this:
Number Friendly Name Serial Number HealthStatus OperationalStatus Total Size Partition
Style
------ ------------- ------------- ------------ ----------------- ---------- ----------
0 WDC WD7500... <redacted> Healthy Online 698.64 GB GPT
You can tack on a | Format-List
to the original command to get an easier-to-read result with more info:
UniqueId : <redacted>
Number : 0
Path : \\?\scsi<redacted>
Manufacturer :
Model : WDC WD7500BPVX-60JC3T0
SerialNumber : <redacted>
Size : 698.64 GB
AllocatedSize : 750151131136
LogicalSectorSize : 512
PhysicalSectorSize : 4096
NumberOfPartitions : 6
PartitionStyle : GPT
IsReadOnly : False
IsSystem : True
IsBoot : True
To get some info on the drive of each partition:
Get-Partition | % {New-Object PSObject -Property @{'PartitionNumber'=$_.PartitionNumber; 'DiskNumber'=$_.DiskNumber; 'DiskModel'=(Get-Disk $_.DiskNumber).Model; 'PartitionSize'=$_.Size; 'DriveLetter'=$_.DriveLetter}}
It produces a collection of PowerShell objects that you can use like those you get out of real cmdlets. When printed to the screen, its output looks like this (some partitions edited out to save vertical space):
DriveLetter :
DiskNumber : 0
DiskModel : WDC WD7500BPVX-60JC3T0
PartitionSize : 681574400
PartitionNumber : 1
DriveLetter : C
DiskNumber : 0
DiskModel : WDC WD7500BPVX-60JC3T0
PartitionSize : 726793488384
PartitionNumber : 4
DriveLetter : D
DiskNumber : 0
DiskModel : WDC WD7500BPVX-60JC3T0
PartitionSize : 21351104512
PartitionNumber : 6
On Windows you can use the Disk Management console.
On Windows 10 you can just right click the start button and in the list should be "Disk Management".
From there you will have a graphical view of the disks, their layout and what drive letter is assigned to each partition.
Western digital have guides for all the recent Windows operating systems at https://support.wdc.com/knowledgebase/answer.aspx?ID=1284 and this is also when I got the image above.
Control panel -> Administrative tools -> computer management -> disk management