Loading

×Sorry to interrupt
CSS Error

Refresh

Cookie Preference Center

General Information on cookies

When you visit our website, we use cookies to ensure that we give you the best experience. This information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies by clicking on the different category headings to find out more and change your settings. However, blocking some types of cookies may impact your experience on the site and the services we are able to offer. Further information can be found in our

Cookie Policy.

Strictly Necessary

Strictly Necessary

Always Active

Strictly Necessary

Strictly necessary cookies are always enabled since they are essential for our website to function. They enable core functionality such as security, network management, and website accessibility. You can set your browser to block or alert you about these cookies, but this may affect how the website functions. For more information please visit www.aboutcookies.org or www.allaboutcookies.org.

Cookie Details‎

Performance

Performance

Performance

Performance cookies are used to analyze the user experience to improve our website by collecting and reporting information on how you use it. They allow us to know which pages are the most and least popular, see how visitors move around the site, optimize our website and make it easier to navigate.

Cookie Details‎

Please confirm your settings by refreshing the page.

Functional

Functional

Functional

Functional cookies help us keep track of your past browsing choices so we can improve usability and customize your experience. These cookies enable the website to remember your preferred settings, language preferences, location and other customizable elements such as font or text size. If you do not allow these cookies, then some or all of these services may not function properly.

Cookie Details‎

Advertising

Advertising

Advertising

Advertising cookies are used to send you relevant advertising and promotional information. They may be set through our site by third parties to build a profile of your interests and show you relevant advertisements on other sites. These cookies do not directly store personal information, but their function is based on uniquely identifying your browser and internet device.

Cookie Details‎

Advertising Cookies

Consent Leg.Interest

Select All Vendors

Select All Vendors

Select All Hosts

Select All

Clear Filters

Information storage and access

Apply

Confirm My Choices Reject All Allow All

My Subscriptions

Loading

Knowledge Base

Using partedUtil command line disk partitioning utility on ESXi (1036609)

Last Updated: 9/27/2023Categories: How toTotal Views: 99222Language:
Chinese (Simplified)Portuguese (European)JapaneseSpanishEnglishGerman

68 like this article

Subscribe to get an email
newsletter with new updates

68 people found this helpful Please provide article feedback:

Learn how VMware Skyline Advisor and Skyline Health Diagnostics work together to provide proactive intelligence and self-service log analysis.

Use Skyline Advisor to avoid issues before they occur across VCF, vSphere, vSAN, NSX, vROps & Horizon. Skyline Findings are based on top KBs, VMSAs/CVEs and design best practices.

Use Skyline Health Diagnostics to root cause vSphere & vSAN logs when an issue occurs. Skyline Health Diagnostic Findings are based on top KBs and VMSA/CVEs. You can use the Skyline Health Diagnostics tool in online or offline mode.

If you require additional help from technical support, please use Skyline Advisor to initiate a Log Assist to reduce time to upload logs. TSEs can also initiate logs to reduce effort.

Purpose

This article provides information on using the partedUtil command-line disk-partitioning utility on VMware ESXi and its use cases.

Note: VMFS datastores can be created and deleted using the vSphere Client connected to an ESXi host or to vCenter Server. It is not necessary to manually create partitions using the command line utility.

For more information for your version of ESXi, see the Managing Storage Devices section of the vSphere Storage Guide.

Resolution

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.

For information on re-creating a missing VMFS partition table using PartedUtil, see Re-creating a missing VMFS datastore partition in vSphere 5.x and 6.x (2046610).

This article covers these tasks:

Retrieving a list of disk devices

Printing an existing partition table

Creating a new partition table (which of the following commands...., type gpt,)

Deleting a partition (parted delete/remove partition. delete partition cmd, )

Resizing a partition (parted resize partition)

Retrieving a list of disk devices

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).

Printing an existing partition table

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:

The starting and ending sectors specify how much contiguous disk space a partition occupies. User-friendly sizes of partitions can be calculated from this information.

Let's take the example of the datastore above, the datastore spans from sector 2048 to 524287966, covering 524285918 (524287966 - 2048) sectors of the disk. This disk has 512 bytes per sector, so this partition is 524285918 x 512 = 268434390016 bytes (approximately 250 GB in size).

The partition type identifies the purpose of a partition and may be represented by either a GUID (for example, AA31E02A400F11DB9590000C2911D1B8) or a decimal identifier (for example, 251). See the list of commonly used partitions in the Additional Information section.

A partition attribute is a number towards the end which identifies properties of the partition. A common attribute is, 128=0x80, which indicates that the partition is bootable. Otherwise, most partitions have an attribute value of 0.

Creating a new partition table

A new partition table can be created on a block disk device using the partedUtil command-line utility. To create a new partition on a block device, use a different command depending on the version of ESXi.

partedUtil setptbl "/vmfs/devices/disks/DeviceName" DiskLabel ["partNum startSector endSector type/guid attribute"]*

For example :

partedUtil setptbl /vmfs/devices/disks/naa.6589cfc000000dcc6071c4243094f34b gpt "1 2048 7516192734 AA31E02A400F11DB9590000C2911D1B8 0"

The break down 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 startSector and endSector specify how much contiguous disk space a partition occupies. The starting sector is enforced to be before the ending sector for the same partition, but no guarantee is made that the partition defined does not overlap another partition.

Note: Volumes that are upgraded from VMFS-3 to VMFS-5 continue to have the VMFS partition starting at sector 128, rather than at sector 2048.

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 marking any change. Ensure that there is no active I/O to a partition prior to modifying it.

The sizing of partitions is outside the scope of this article.

Deleting a partition

A single partition can be deleted from a partition table on a device using the partedUtil command-line utility.

To delete a partition, run this command:

partedUtil delete "/vmfs/devices/disks/DeviceName" PartitionNumber

For example:

partedUtil delete "vmfs/devices/disks/naa.6589cfc000000dcc6071c4243094f34b" 1

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.

Resizing a partition

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.

Related Information

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

Unable to connect to an ESX host using Secure Shell (SSH)

Partition table fails to update active partitions

Identifying disks when working with VMware ESXi

Usando o utilitário da linha de comando partedUtil no ESXi e ESX

Usar la utilidad de línea de comandos partedUtil en ESXi y ESX

在 ESXi/ESX 上使用 partedUtil 命令行实用程序

ESX および ESXi で partedUtil コマンドライン ユーティリティを使用する

Verwenden des Befehlszeilen-Dienstprogramms „partedUtil“ für ESXi und ESX

Detectable by VMware SkylineTM

Actions

Copy

link to clipboard
copied!

Print

Language:
Chinese (Simplified)Portuguese (European)JapaneseSpanishEnglishGerman

Attachments

Additional Resources

No results for undefined

Ask The Community

Get answers quickly from VMware experts in the community

Post Subject

CONTINUE IN COMMUNITIES

Related Products:

VMware vSphere ESXi

VMware ESXi

Related Versions:

VMware vSphere ESXi 8.0.x

VMware vSphere ESXi 7.0.x

VMware vSphere ESXi 6.7

VMware vSphere ESXi 6.5

VMware vSphere ESXi 6.0

Take Our Survey

Support Assistant