none
How Do I Find the Partition GUID? RRS feed

  • Question

  • I'm new to server administration and I've been looking for a way to find the GUID of a partition on a hard drive.  I've read a lot of articles on GPT and partitioning in general, and I reviewed all the articles suggested in the Related Topics section that opens up when a person goes to post a question in these forums, and thus far nothing I've read has given me the answer.

    I can find the GUID of the hard drive, but drives can contain multiple partitions, and I'd like to be able to find the GUID for any partition.  I'd like to use a script to retrieve the partition GUIDs for a drive, but I'd also like to be able to get the GUIDs manually as a check against the script results.

    Can anyone tell me how to find the GUIDs for the partitions on a drive?

    Thanks for any help that you can offer.

    --Tom

    Wednesday, September 5, 2012 12:46 AM

Answers

  • I understand perfectly thankyou.

    However, you can have a partition on a disk that doesnt necessarily have a volume in windows.

    A volume must have a partition that it is applied to, however a partition doesnt always have to have a volume, a single partition can also contain multiple volumes (extended partitions if you will, where multiple logical drives can be created within it)

    You can refer to the following reference for the differences between a volume and a partition

    http://en.wikipedia.org/wiki/Volume_(computing)

    .

    Regardless of which, the powershell command I provided still provides the solution to the original query

    .

    If you would like further evidence of the difference between partitions and volumes as far as windows is concerned, you can refer to the WMI namespace for each

    This will return all of the partitions that exist (powershell)

    GWMI -namespace root\cimv2 -class win32_DiskPartition

    This will return all of the volumes that exist (powershell)

    GWMI -namespace root\cimv2 -class win32_volume

    Notice how there are more volumes than partitions?

    So, as I said before, I don't believe windows assigns GUID's to partitions, but it does to Volumes.


    Kriss Milne, MCSE | Infrastructure Specialist





    • Edited by Kriss Milne Friday, September 21, 2012 8:21 AM
    • Marked as answer by thomasm516 Friday, January 10, 2014 4:25 PM
    Friday, September 21, 2012 7:55 AM

All replies

  • Hi , 

    You can find GUID of disk using diskpart.

    Start>run>cmd>diskpart>list disk and check for GPT

    Start>run>cmd>diskpart>list disk>select disk> uniqueid disk and check for disk ID

    Note: Run diskpart command with elevated admin rights..


    Regards, Ravikumar P

    Wednesday, September 5, 2012 2:44 AM
  • That's the GUID for the *disk*.  I need the GUID for the *partition*.

    For example, if a server has one physical drive that contains three partitions--an ESP, a primary partition for the OS, and a data partition--how would I get the GUID for the data partition?

    --Tom

    Wednesday, September 5, 2012 6:00 AM
  • Hello Tom, 

    I regret the delay in replying to you. After all my research & search in Technet  found an useful command "mountvol" to know the GUID of a partition.
    Start>run>cmd>mountvol C:\ /L --to know GUID of C partition.

    Use mounvol /? to know more options of a command.
    Note:Run command with elevated rights for better results.Also run it in test lab before using it in live environment.

    That is all for you. Thank you and please let us know if you need any other help.?


    Regards, Ravikumar P

    • Proposed as answer by Hitesh.N.Patel Wednesday, October 8, 2014 6:06 PM
    Friday, September 21, 2012 4:52 AM
  • I dont believe that windows assigns GUID's to 'Partitions' but I'm assuming that you're actually looking for the GUID of the 'Volume'

    You can use WMI to get the information, See the following powershell example:

    GWMI -namespace root\cimv2 -class win32_volume | FL -property DriveLetter, DeviceID


    Kriss Milne, MCSE | Infrastructure Specialist

    Friday, September 21, 2012 5:12 AM
  • I dont believe that windows assigns GUID's to 'Partitions' but I'm assuming that you're actually looking for the GUID of the 'Volume'

    You can use WMI to get the information, See the following powershell example:

    GWMI -namespace root\cimv2 -class win32_volume | FL -property DriveLetter, DeviceID


    Kriss Milne, MCSE | Infrastructure Specialist

    Hello Kriss, 

    I am not convincing with you. When you are considering a basic disk, partitions are representing as volumes.

    I suggest you use diskpart utility to know more about it.

    diskpart>select disk # --Select disk to know number of paritions in it.

    diskpart>list volume and check for volume numbers associated with the partitions.

    even run diskpart>list partition and can see the same.

    Thank you for understanding.




    Regards, Ravikumar P

    Friday, September 21, 2012 6:02 AM
  • I understand perfectly thankyou.

    However, you can have a partition on a disk that doesnt necessarily have a volume in windows.

    A volume must have a partition that it is applied to, however a partition doesnt always have to have a volume, a single partition can also contain multiple volumes (extended partitions if you will, where multiple logical drives can be created within it)

    You can refer to the following reference for the differences between a volume and a partition

    http://en.wikipedia.org/wiki/Volume_(computing)

    .

    Regardless of which, the powershell command I provided still provides the solution to the original query

    .

    If you would like further evidence of the difference between partitions and volumes as far as windows is concerned, you can refer to the WMI namespace for each

    This will return all of the partitions that exist (powershell)

    GWMI -namespace root\cimv2 -class win32_DiskPartition

    This will return all of the volumes that exist (powershell)

    GWMI -namespace root\cimv2 -class win32_volume

    Notice how there are more volumes than partitions?

    So, as I said before, I don't believe windows assigns GUID's to partitions, but it does to Volumes.


    Kriss Milne, MCSE | Infrastructure Specialist





    • Edited by Kriss Milne Friday, September 21, 2012 8:21 AM
    • Marked as answer by thomasm516 Friday, January 10, 2014 4:25 PM
    Friday, September 21, 2012 7:55 AM
  • I dont believe that windows assigns GUID's to 'Partitions' but I'm assuming that you're actually looking for the GUID of the 'Volume'

    You can use WMI to get the information, See the following powershell example:

    GWMI -namespace root\cimv2 -class win32_volume | FL -property DriveLetter, DeviceID


    Kriss Milne, MCSE | Infrastructure Specialist

    Hello Kriss, 


    wenn windows keine GUID's für Partitionen erstellt, warum erhält man beim ausführen des Serverbackups
    dann die Fehlermeldung:

    "-backupTarget  Gibt den Speicherort an, an dem die Sicherung gespeichert werden soll.
                    Für den Speicherort ist ein Laufwerkbuchstabe oder ein GUID-basiertes
                    Volume mit dem folgenden Format erforderlich: \\?\Volume{GUID}.

    Probiere es aus. Der von Dir beschriebene Befehl gibt jedenfalls die Meldung:
    Der Befehl "GWMI" ist entweder falsch geschrieben oder
    konnte nicht gefunden werden." zurück

    Gruß

    Wednesday, November 27, 2013 12:29 PM
  • Kriss,

    I was just reviewing some of the questions that I've posted in the past and noticed that I had not marked an answer on this one.

    We have undergone a reorganization since I posted the original query, and the project I was working on at the time was given to another unit, so I have not tried your proposed solution.  However, I did review all the information that you posted and believe that your response answers my question.  I have added the information to my PowerShell and server admin notes and will test it at some point in the future.

    Thanks for the information.

    --Tom

    Friday, January 10, 2014 5:04 PM
  • Hallo Frankyboy,

    Hier hat das comando funktioniert, bist du sicher das du das comando in einem powershell ausgeführt hast?

    Ich habe dieses comando benutzt: 

    GWMI -namespace root\cimv2 -class win32_volume | FL -property Label,DriveLetter,DeviceID,SystemVolume,Capacity,Freespace


    Wednesday, January 15, 2014 9:44 AM
  • Thank you so much, that has just made me so more smarter. 

    Diskpart doesn't seem to show the GUID. The only tools that work as far as I have seen are mountvol /? and this:

    GWMI -namespace root\cimv2 -class win32_volume | FL -property Label,DriveLetter,DeviceID,SystemVolume,Capacity,Freespace

    But the GWMI command is better because if the volume is not mounted and using mountvol /? you can not tell at one glance which partitions\volumes are what if you have more than 1 partiton without dirve letter assigned (very common on UEFI, GPT partitions (especially on notebooks that have also OEM recovery partitions)

    I wonder If there is a way to find out the partition GUID through the registry but I made a search by putting a DeviceID output of my Reserved partition on the search box and It didn't return anything.

    Windows requires the GUID of volumes on several of its command line tools like wbadmin (the command line version of system image backup) but doesn't provide an obvious way to get them.

    Thanks again to everybody providing information on this topic, and greetings from Brazil.

    Ricardo Bohner

    


    • Edited by Ricardo Bohner Wednesday, January 15, 2014 10:17 AM
    • Proposed as answer by Hexaae Sunday, May 22, 2016 9:39 AM
    Wednesday, January 15, 2014 10:15 AM
  • >diskpart

    >list disk

    >sel disk num

    >list part

    >sel part num

    >detail disk

    >detail part

    Thursday, January 26, 2017 9:15 AM
  • My solution - I was looking for the partition id - for use in the automation of

    bcdedit /default {guid}

    The only way I have been able to list them is this kind of wrapping up:

    $part = bcdedit
    $part+= '-------------------'; 
    $d = @{}; 
    $partitions = $part -split '[\r\n]'|?{-not [string]::isnullorempty($_.trim()) -and $_ -ne 'Windows Boot Loader' -and $_ -ne 'Windows Boot Manager'} `
    	|%{if ($_ -like '-------------------*')  {if ($d) { New-Object -TypeName psobject -Property $d }; $d = @{}}else {select-string '([{}\w]+)' -input $_ -allmatches|%{$d += @{$_.matches[0].value=$_.matches[1..9].value -join ' '} } }}
    $partitions | select description,path,osdevice,resumeobject | ft
    
    description          path                            osdevice    resumeobject
    -----------          ----                            --------    ------------
    
    Windows Boot Manager EFI Microsoft Boot bootmgfw efi             {9a85e3f5 e4d3 11e7 b20c a44cc87ed073}
    Windows 10           WINDOWS system32 winload efi    partition C {9a85e3f5 e4d3 11e7 b20c a44cc87ed073}
    Apologies the writing the code all on one line, it's my way of composing as a go, and might make come code look like a comment not code. Just paste and run, it works as long as your console width is at least 120 characters, wider is better.

    automation of testing the stuff dude

    Wednesday, April 18, 2018 8:50 AM
  • HI there

    i am in need to map a volume from my storage center to a server. Each time i do that a new volume GUID is created. Is there  away to keep it the same because i need to use that GUID in a script.

    Thanks

    Tuesday, November 27, 2018 1:36 PM
  • Can anyone tell me how to find the GUIDs for the partitions on a drive?

    Thanks for any help that you can offer.

    --Tom

    All these answers answer only the "Windows Volume GUID" or "Windows ID". Just in case you were searching for the GPT Partition GUID:

    diskpart

    select disk 0

    select partition 1

    detail partition

    DISKPART> detail partition
    
    Partition 1
    Typ         : ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
    Versteckt   : Nein
    Erforderlich: Nein
    Attribut    : 0000000000000000
    Offset in Byte: 1048576
    
      Volume ###  Bst  Bezeichnung  DS     Typ         Größe    Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
    * Volume 0     W                FAT32  Partition    100 MB  Fehlerfre  System
    

    Compare with the Windows GUID of the VOLUME of the same partition you can see the difference:

    PS C:\Windows\system32> GWMI -namespace root\cimv2 -class win32_volume | FL -property Label,DriveLetter,DeviceID,SystemVolume,Capacity,Freespace
    
    Label        :
    DriveLetter  : W:
    DeviceID     : \\?\Volume{8f299a20-ee36-01d4-10cd-94471b77ea00}\
    SystemVolume : True
    Capacity     : 100663296
    Freespace    : 72939520

    I will now assign "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" as EFI-PARTITON id. The machine boots fine, but bcdedit fails to find the star configuration ;).

    Reference: https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs

    Sunday, April 14, 2019 7:52 AM