Reminder to self when checking “new” disks to see what partitions they contain before formatting them as VMFS.
There is a truckload information at [WayBack] Using the partedUtil command line utility on ESXi and ESX (1036609) | VMware KB.
A few tips; example output is further below:
- Disks are listed under
/vmfs/devices/disks/
where there are two entries per device: a path leading to the device, and a link to that path which starts withvml.
which I filter out with grep. - If a disk under under
/vmfs/devices/disks/
ends with:#
where#
is a number, then it is a partition - Just skip
partedUtil get
aspartedUtil getptbl
will give you exactly the same information,- plus an extra initial line indicating what kind of partition table it is. KB 1036609 has a longer list, but these are the ones you usually see:
unknown
: the disk has no partition table yet (usually), or the type of partition table cannot be determined (hardly)gpt
: there is a GUID Partition Tablemsdos
: there is a Master Boot Record partition table
- on ESXi 6.x two extra columns listing the partition GUID and partition type description
- plus an extra initial line indicating what kind of partition table it is. KB 1036609 has a longer list, but these are the ones you usually see:
- The output of
partedUtil
is unformatted, which means it is easy to parse, but hard to read for humans. You can pipe throughsed 's/ /\t/g'
(as there is notr
on the ESXi busybox)
Some more background reading
On scripting:
- The shell is
sh
(always been there) - There is
Python
(ESXi 5.1 hasPython 2.7.8
; ESXi 6.5 hasPython 3.5.3
; it has likely been available in earlier versions too).
On device names:
- [WayBack] Understanding Storage Device Naming
- [WayBack] Identifying disks when working with VMware ESXi/ESX (1014953) | VMware KB
On errors:
Module 'Disk' power on failed.
(in thevmware.log
file for the VM) andLookupAndOpen[file] failed Click here for more details.
(in the Web UI): my impression this is usually has to do with either a mismatch of the text vmdk and the binary backing, or the chain of snapshots. The odd thing is thatvmkfstool
doesn’t always catch this and just returnsDisk is error free
.
Interesting related posts:- [WayBack] “The parent virtual disk has been modified since the child was created” error (1007969) | VMware KB
- [Archive.is] How to fix CID mismatch error. Editing virtual disk snapshot chain
- [WayBack] ESXi 6.5 Host Crash then Guest Fails to Power On | JC-LAN.tk (you can always try to use
vmkfstools -x check /path/to/vmname.vmdk
followed byvmkfstools -x repair/path/to/vmname.vmdk
- “Failed to create VMFS datastore … Cannot change the host configuration“:
and“WriteNewPtable: Unable to commit to disk” can happen for a disk that is listed asunknown
, but for which VMware doesn’t know what to do with it. Basically three things to try:- Hook it up to a Linux VM or Live CD, then use respectively
gparted
to edit the partition table. - Hook it up to a Windows VM or live PC, then use
diskpart
ordiskmgmt.msc
to edit the partition table. - If you are sure it is empty, overwrite the partition table with an empty
msdos
one:
- Hook it up to a Linux VM or Live CD, then use respectively
-
~ # find /vmfs/devices/disks/ | grep T1500LM0032D9YH148
/vmfs/devices/disks/t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0a
~ # partedUtil getptbl /vmfs/devices/disks/t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0
unknown
182401 255 63 2930277168
~ #
- [WayBack] “Cannot change the host configuration” error message when adding disk storage to a VMware vSphere ESXi Host
I know of three VMFS types:
- VMFS-3: Supported in ESXi 3.X, 4.X, 5.x & 6.x; deprecated as of 6.0 (cannot be created as of 6.0), has quite some limitations.
- VMFS-4: got never released.
- VMFS-5: Can be converted from VMFS-3
- VMFS-6: Cannot be converted from other VMFS types
Some interesting links about the various VMFS types:
- [WayBack] Difference Between VMFS 3 and VMFS 5
- [WayBack] Upgraded VMFS-5: Automatic Partition Format Change – VMware vSphere Blog
- [WayBack] Frequently Asked Questions on Deprecation and End of Support (EOS) for VMFS-3 in VMware vSphere 6.0.x (2093576) | VMware KB
- [WayBack/Archive.is] How to Create VMFS 6 Datastore in VMware vSphere 6.5 – Virtualization Howto
- [Archive.is] vSphere 6.5 – What’s New in VMFS 6 Datastore – VMWare Insight
Busybox has been updated over time:
- [WayBack] How to compile Busybox for ESXi … kind of Part 1 | virtuallyGhetto
- [WayBack] How to compile Busybox for ESXi … kind of Part 2 | virtuallyGhetto
- [WayBack] How to Persist Configuration Changes in ESXi 4.x/5.x Part 1 | virtuallyGhetto
- [WayBack] Increase Syslog count in ESXi using Busybox | virtuallyGhetto
- As there is a built-in
traceroute
now, this is not needed any more: [WayBack] Poor man’s traceroute for ESXi | virtuallyGhetto (https://github.com/leonidg/Poor-Man-s-traceroute/blob/master/traceroute.py needs to be updated to be compatible with Python 3 anyway).
Examples and output
Example outputs on one of my systems, of which I stripped most of the disks as they’re not really relevant here.
[root@ESXi-X10SRH-CF:~] ls -1 /vmfs/devices/disks/ | grep -v '^vml\.' naa.5000c50087762d1b ... naa.600605b00aa054a0ff000021022683ae naa.600605b00aa054a0ff000021022683ae:1 ... t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0 t10.ATA_____Samsung_SSD_850_PRO_2TB_________________S2KMNCAGB04321L_____ t10.ATA_____Samsung_SSD_850_PRO_2TB_________________S2KMNCAGB04321L_____:1 ... t10.SanDisk00Ultra_Fit000000000000004C530001240406103372 t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:1 t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:5 t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:6 t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:7 t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:8 t10.SanDisk00Ultra_Fit000000000000004C530001240406103372:9 [root@ESXi-X10SRH-CF:~] partedUtil getptbl /vmfs/devices/disks/t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0 unknown 182401 255 63 2930277168 [root@ESXi-X10SRH-CF:~] partedUtil get /vmfs/devices/disks/t10.ATA_____ST1500LM0032D9YH148__________________________________Z110C4Q0 182401 255 63 2930277168 [root@ESXi-X10SRH-CF:~] partedUtil get /vmfs/devices/disks/t10.ATA_____SAMSUNG_MZHPV512HDGL2D00000______________S1X1NYAGB09589______ 62260 255 63 1000215216 1 2048 1000214527 0 0 [root@ESXi-X10SRH-CF:~] partedUtil getptbl /vmfs/devices/disks/t10.ATA_____SAMSUNG_MZHPV512HDGL2D00000______________S1X1NYAGB09589______ gpt 62260 255 63 1000215216 1 2048 1000214527 AA31E02A400F11DB9590000C2911D1B8 vmfs 0 [root@ESXi-X10SRH-CF:~] partedUtil getptbl /vmfs/devices/disks/t10.SanDisk00Ultra_Fit000000000000004C530001240406103372 gpt 3738 255 63 60062500 1 64 8191 C12A7328F81F11D2BA4B00A0C93EC93B systemPartition 128 5 8224 520191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0 6 520224 1032191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0 7 1032224 1257471 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0 8 1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0 9 1843200 7086079 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0 [root@ESXi-X10SRH-CF:~] partedUtil get /vmfs/devices/disks/t10.SanDisk00Ultra_Fit000000000000004C530001240406103372 3738 255 63 60062500 1 64 8191 0 128 5 8224 520191 0 0 6 520224 1032191 0 0 7 1032224 1257471 0 0 8 1257504 1843199 0 0 9 1843200 7086079 0 0 [root@ESXi-X10SRH-CF:~] partedUtil getptbl /vmfs/devices/disks/t10.SanDisk00Ultra_Fit000000000000004C530001240406103372 | sed 's/ /\t/g' gpt 3738 255 63 60062500 1 64 8191 C12A7328F81F11D2BA4B00A0C93EC93B systemPartition 128 5 8224 520191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0 6 520224 1032191 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0 7 1032224 1257471 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0 8 1257504 1843199 EBD0A0A2B9E5443387C068B6B72699C7 linuxNative 0 9 1843200 7086079 9D27538040AD11DBBF97000C2911D1B8 vmkDiagnostic 0 [root@ESXi-X10SRH-CF:~] partedUtil get /vmfs/devices/disks/t10.SanDisk00Ultra_Fit000000000000004C530001240406103372 | sed 's/ /\t/g' 3738 255 63 60062500 1 64 8191 0 128 5 8224 520191 0 0 6 520224 1032191 0 0 7 1032224 1257471 0 0 8 1257504 1843199 0 0 9 1843200 7086079 0 0 [root@ESXi-X10SRH-CF:~] partedUtil --help Usage: Get Partitions : get Set Partitions : set ["partNum startSector endSector type attr"]* Delete Partition : delete Resize Partition : resize Get Partitions : getptbl Set Partitions : setptbl ["partNum startSector endSector type/guid attr"]* Fix Partition Table : fix Create New Label (all existing data will be lost): mklabel Show commonly used partition type guids : showGuids Get usable first and last sectors : getUsableSectors Fix GPT Table interactively : fixGpt [root@ESXi-X10SRH-CF:~] partedUtil showGuids Partition Type GUID vmfs AA31E02A400F11DB9590000C2911D1B8 vmkDiagnostic 9D27538040AD11DBBF97000C2911D1B8 vsan 381CFCCC728811E092EE000C2911D0B2 virsto 77719A0CA4A011E3A47E000C29745A24 VMware Reserved 9198EFFC31C011DB8F78000C2911D1B8 Basic Data EBD0A0A2B9E5443387C068B6B72699C7 Linux Swap 0657FD6DA4AB43C484E50933C84B4F4F Linux Lvm E6D6D379F50744C2A23C238F2A3DF928 Linux Raid A19D880F05FC4D3BA006743F0F84911E Efi System C12A7328F81F11D2BA4B00A0C93EC93B Microsoft Reserved E3C9E3160B5C4DB8817DF92DF00215AE Unused Entry 00000000000000000000000000000000 [root@ESXi-X10SRH-CF:~] cat /local/bin/what-is-my-shell.sh if test -n "$ZSH_VERSION"; then PROFILE_SHELL=zsh elif test -n "$BASH_VERSION"; then PROFILE_SHELL=bash elif test -n "$KSH_VERSION"; then PROFILE_SHELL=ksh elif test -n "$FCEDIT"; then PROFILE_SHELL=ksh elif test -n "$PS3"; then PROFILE_SHELL=unknown else PROFILE_SHELL=sh fi echo $PROFILE_SHELL echo $SHELL [root@ESXi-X10SRH-CF:~] /local/bin/what-is-my-shell.sh sh /bin/sh [root@ESXi-X10SRH-CF:~] python --version Python 3.5.3 [root@ESXi-X10SRH-CF:~]
–jeroen