VMware vSphere ESXi 6.x
VMware vSphere ESXi 7.x
VMware vSphere ESXi 8.x
You can use the partedUtil command-line utility to directly manipulate partition tables for local and remote SAN disks on ESXi.
The partedUtil command-line only is supported for disk partitioning from ESXi 5.x and above. The command-line utility fdisk does not work with LUNs formatted with VMFS5 or VMFS6.
Note: This article assumes that a console session is available to the ESXi, and that you are familiar with the console and disk management concepts, and that you have made adequate backups before proceeding.
This article covers these tasks:
Each partedUtil command accepts a device argument specifying a local or SAN-based disk to operate against. This should be a path name beginning with /vmfs/devices/disks/. It should specify the whole block device rather than an existing partition on the device.
To obtain a list of disk device names that can be managed by partedUtil, run this command:
ls -ltrh /vmfs/devices/disks/
Example output shared below:
The fields listed in blue are the vml IDs of the same devices highlighted below.
Note: When specifying a block device using the partedUtil command, use the full path and enclose it in double-quotes.
For example:
partedUtil getptbl "/vmfs/devices/disks/mpx.vmhba0:C0:T0:L0"
For more information on identifying a specific disk device, see Identifying disks when working with VMware ESX (1014953).
An existing partition table on a block disk device may be examined using the partedUtil command-line utility. To obtain a list of partitions defined on a block disk device:
partedUtil getptbl "/vmfs/devices/disks/DeviceName"
For example:
partedUtil getptbl /vmfs/devices/disks/naa.6589cfc000000dcc6071c4243094f34b
gpt
32635 255 63 524288000
1 2048 524287966 AA31E02A400F11DB9590000C2911D1B8 vmfs 0
The first line is only present in the getptbl form of the command and displays the disk label identifying the partitioning scheme being used. Common labels are bsd, dvh, gpt, loop, mac, msdos, pc98, and sun. Of these, only the msdos (VMFS3) label and gpt (VMFS5 and VMFS6) partitioning scheme is used by ESXi/ESX.
Note: The label msdos does not mean that the device contains a Windows file system or is being used by a Windows machine. It only means that it is MBR (Master Boot Record) partition.
The second line displays the disk geometry information read from the underlying device(esxi partition layout/label):
The remaining lines identify each defined partition. If no partitions are defined, this list is blank. The list may not be sorted.
For example: Here there is 1 partition defined.
Properties of a partition:
For example :
partedUtil setptbl /vmfs/devices/disks/naa.6589cfc000000dcc6071c4243094f34b gpt "1 2048 7516192734 AA31E02A400F11DB9590000C2911D1B8 0"
The breakdown of the command is as follows:
DiskLabel - gpt
partNum - 1
startSector - 2048
endSector - 7516192734
GUID - AA31E02A400F11DB9590000C2911D1B8
attribute - 0
The disk label is only specified in the setptbl form of the command and sets the disk label identifying the partitioning scheme being used. Common labels are bsd, dvh, gpt, loop, mac, msdos, pc98 and sun.
ESXi 5.x and higher supports both the msdos and gpt label and partitioning schemes, while ESXi/ESX 4.1 and earlier supports the msdos label and partitioning scheme exclusively.
The list of partitions to apply to the disk must be fully specified on the partedUtil command line. To add additional partitions to a disk with an existing partition, specify both the original and new partitions on the command line. If you do not, the existing partition is lost. The list of partitions is specified as quoted strings, each of which encapsulates a 5-tuple composed of the partition number, starting sector, ending sector, type ID, and attributes.
For Example: To create two consecutive ~244 MB partitions of type gpt, the first of which is bootable and starts at offset 2048. The command to be used in this scenario would be as follows:
partedUtil setptbl "/vmfs/devices/disks/naa.6589cfc000000dcc6071c4243094f34b" gpt "1 2048 500000 AA31E02A400F11DB9590000C2911D1B8 2048" "2 500001 999999 AA31E02A400F11DB9590000C2911D1B8 0"
The partecUtil command can be used to resize an existing partition. This does not resize the file system within the partition and is no different from deleting and recreating the partition with a new starting or ending sector.
To resize a partition, run this command:
partedUtil resize "/vmfs/devices/disks/DeviceName" PartitionNumber NewStartSector NewEndSector
For example:
To increase the partition size of the above listed VMFS datastore from its existing last sector 524287966 to a new last sector 8679954582, the following command needs to be executed:
partedUtil resize "/vmfs/devices/disks/naa.6589cfc000000dcc6071c4243094f34b" 1 2048 8679954582
Caution: There is no facility to undo a partition table change other than creating a new partition table. Ensure that you have a backup before making any change. Ensure that there is no active I/O to a partition before modifying it.
The partition type identifies the purpose of a partition and may indicate intended usage by a particular operating system. Partition types must be specified by the GUID only in the partition table (when running the partedUtil setptbl command).
You can obtain the GUID by running the command:
partedUtil showGuids
Partition types commonly seen by ESXi includes:
Partition | GUID | Type (Hex) | Type (Decimal) |
VMFS Datastore | AA31E02A400F11DB9590000C2911D1B8 | 0xFB | 251 |
VMKCore Diagnostic | 9D27538040AD11DBBF97000C2911D1B8 | 0xFC | 252 |
VMware Reserved | 9198EFFC31C011DB8F78000C2911D1B8 | ||
Basic Data | EBD0A0A2B9E5443387C068B6B72699C7 | 0x83 | 131 |
Linux Swap | 0657FD6DA4AB43C484E50933C84B4F4F | 0x82 | 130 |
Linux LVM | E6D6D379F50744C2A23C238F2A3DF928 | 0x8E | 142 |
Linux RAID | A19D880F05FC4D3BA006743F0F84911E | 0xFD | 253 |
EFi System | C12A7328F81F11D2BA4B00A0C93EC93B | 0xEF | 239 |
Microsoft Reserved | E3C9E3160B5C4DB8817DF92DF00215AE | ||
Unused Entry | 00000000000000000000000000000000 | ||
Fat16 | 0x6 | 6 | |
Extended | 0x5 | 5 | |
SFS | 0x42 | 66 | |
NTFS | 0x7 | 7 |