Share via


set GPT labels with diskpart

Question

Wednesday, February 3, 2016 3:37 PM | 1 vote

Is it possible to specify GPT labels with diskpart or another Microsoft tool?

All replies (7)

Thursday, February 4, 2016 3:19 AM ✅Answered

Hi theking2,

If you mean disk label, as shared by Darrell Gorter, label.exe is the tool which could achieve this.

For Diskpart, it will only allow to Label the partition when using the format option:

See:

DiskPart Command-Line Options

https://technet.microsoft.com/en-us/library/cc766465(v=ws.10).aspx

And:

https://technet.microsoft.com/en-us/library/bb490925.aspx

Regards

Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected].


Thursday, February 4, 2016 3:19 PM ✅Answered

Sure you are right.

The GPT label is a type of GPT partition.

You can do that with diskpart:

#list disks
DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
            
  Disk 4    Online          150 GB      0 B        *
#set focus on Disk 4 to view its metadata
DISKPART> sel disk 4
Disk 4 is now the selected disk.
#set focus on the partition that you want to label (1st partition in this example)
DISKPART> sel part 1
Partition 1 is now the selected partition.
DISKPART> SET ID=<LABEL/PARTITIONTYPE>

Well this is the world we live in And these are the hands we're given...


Wednesday, February 3, 2016 6:30 PM

Hello,

Label.exe is way to change the disk label:

C:\WINDOWS\system32>label /?                                                

Creates, changes, or deletes the volume label of a disk.                                                                                                  

LABEL [drive:][label]                                                       

LABEL [/MP] [volume] [label]                                                                                                                                

drive:          Specifies the drive letter of a drive.                      

label           Specifies the label of the volume.                          

/MP             Specifies that the volume should be treated as a mount point or volume name.                                 

volume          Specifies the drive letter (followed by a colon), mount point, or volume name.  If volume name is specified, the /MP flag is unnecessary                                             

                      

Thanks, Darrell Gorter [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights.


Thursday, February 4, 2016 2:57 PM

Correct me if I'm wrong but label,exe will set the file system label, not the gpt label.


Thursday, February 4, 2016 3:21 PM

To find out what are the available GPT partition types, see PARTITION_INFORMATION_GPT structure.

Well this is the world we live in And these are the hands we're given...


Thursday, February 4, 2016 3:35 PM

By the way, to edit GPT labels you must boot from EFI firmware, look for EFI files on the boot disk:

bootmgfw.efi

BOOTX64.EFI

See also

Creating Windows UEFI Boot-Stick in Windows

Well this is the world we live in And these are the hands we're given...


Friday, May 5, 2017 5:32 PM

To find out what are the available GPT partition types, see PARTITION_INFORMATION_GPT structure.

Thanks for that link to the structure. I'm looking for a way to set the name parameter. This is useful on a multiboot system as other OSses allow setting reading and modifiying these partition "names"