23

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.

  • Please open CMD, and type diskpart, then technet.microsoft.com/en-us/library/cc766465(v=ws.10).aspx – dExIT Nov 18 '16 at 12:40
  • 3
    @dExIT It's really hard to get diskpart to print anything at all. It also resists interactive usage attempts (it tries to open in a separate graphical window, which it then immediately closes). I tried putting it in a foo.bat file followed by pause command, but it just doesn't display any output whatsover. – wvxvw Nov 18 '16 at 12:59
24

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.

  • 1
    Close, but not really. It doesn't say anywhere what's the disk name. The only way I see how I can distinguish between different disk is by their size, which isn't enough information to figure out which disks are those. – wvxvw Nov 18 '16 at 12:57
  • 1
    @wvxvw I've edited my post to give you the information you seek. – LPChip Nov 18 '16 at 13:05
  • You can also run diskmgmt.msc from Start => Run or Command Prompt to open Disk Management directly. – BACON Nov 18 '16 at 16:54
  • Why the "[EDIT]" tag? You know bb-codes don't work here. I'm confused. – user1306322 Nov 19 '16 at 15:39
  • I edited text in between, and this seemed to be the best way to clarify what I added – LPChip Nov 19 '16 at 16:43
15

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

11

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
  • 2
    +1. Get-Disk -Partition (Get-Partition -DriveLetter 'C') can also be used to the same effect. – BACON Nov 18 '16 at 17:39
9

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.

enter image description here

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.

3

Control panel -> Administrative tools -> computer management -> disk management

0

You can use CrsytalDiskInfo

https://crystalmark.info/en/download/#CrystalDiskInfo

You can see immediately which partition or logic drive pertains to which physical drive.

Rapid and easy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.