VMware {code} Community
PavelKirov
Contributor
Contributor

Unable to enforce GPT format using UpdateDiskPartitions


Greetings,


It started when I realized that I cannot create LUN-backed datastore larger than 2 TB using

CreateVmfsDatastore

even though vSphere Client (ESXi 5.1.0) creates it without complaints. No matter what size of datastore I specify, it appears with size 2 TB sitting on MBR partition (original LUN is raw). In attempts to make it working I specified


vmfsDatastoreCreateSpec.partition.partitionFormat = vim.HostDiskPartitionInfoPartitionFormat.gpt
vmfsDatastoreCreateSpec.vmfs.majorVersion = 5




without desired effect. Digging deeper, I thought I can split operations what

CreateVmfsDatastore

performs (presumably) behind the scene:

UpdateDiskPartitions

+

FormatVmfs

, so my call looked like:


devicePath = '/vmfs/devices/disks/naa.600a0980383030364746314b464d6f2f'

diskPartitionSpec = self.storageSystem.RetrieveDiskPartitionInfo(devicePathdevicePath])[0].spec

diskPartitionSpec.partitionFormat = vim.HostDiskPartitionInfoPartitionFormat.gpt

type = vim.HostDiskPartitionInfoType.vmfs

logical = False

attributes = 0

partition = 1

startSector = 2048

endSector = diskPartitionSpec.totalSectors - 2048

partitionAttributes = vim.HostDiskPartitionAttributes(attributes=attributes, endSector=endSector,

logical=logical, partition=partition, startSector=startSector, type=type)

diskPartitionSpec.partition =

self.storageSystem.UpdateDiskPartitions(devicePath=devicePath, spec=diskPartitionSpec)


No effect again, LUN appears as formatted with MBR. Could someone be so kind to shed the light on this magic and direct me how to create GPT partitioning?


Thank you!

0 Kudos
0 Replies