I am a bit behind on my series here, and this was not meant to be in it, but after a conversation around it on Reddit, I dug in.

I posted about this earlier:

https://www.codyhosterman.com/2020/03/whats-new-in-vsphere-7-0-storage-part-ii-guestinfo-virtualdiskmapping/

But it was about the API and only Windows. What about Linux? What about getting it with PowerCLI?

All good questions.

Linux

So Windows works. Though there is one gotcha, the NVMe adapter breaks it, so the virtual disk mapping will not work if the disk is connected using the NVMe adapter.

PVSCSI, LSI Logic, work fine.

What about Linux?

Well let’s deploy a new VM:

Okay VM deployed.

Let’s take a look at the managed object browser and see the root disk mapping.

What?! No mapping…

Doing the old googling i found this recent post:

https://blogs.vmware.com/PowerCLI/2020/04/new-release-powercli-12.html

There is a line that says:

“Lastly, the initial release of the vSphere API only supports Windows operating systems.”

I confirmed right before posting that Linux is supported though, so that line can be ignored.

Okay so part of the requirement as I said earlier is the newest version of VM tools. Version 11. What version do I have?

Well that certainly won’t do it. Ancient!

Let’s upgrade.

sudo apt-get update sudo apt-get install open-vm-tools vmware-toolbox-cmd -v

Voila!

Okay so at least on the right version. Let’s try the API again through the MoB:

Foiled again! But I refuse to give up on my Linux dream.

I found this message in a log file on my VM called vmware-vmsvc-root.log

[ warning] [guestinfo] GuestInfoGetDiskDevice: Missing disk device name; VMDK mapping unavailable for "/", fsName: "/dev/sda2"

Which eventually led me here:

https://github.com/vmware/open-vm-tools/issues/404

It is a SCSI adapter thing! Makes sense. That is the go between.

Let’s shut it down and restart with the PVSCSI adapter:

Check the MoB…

It works!

What about the other adapters? NVMe? LSI SAS?

Just to check, let’s try LSI SAS:

Mount the disk with ext4 at /mnt/SAS:

And it works!

Now what about LSI Parallel? Yes I know I already said it didn’t work, but there is a comment in the above Github issue about PCI slot 0, so maybe it only doesnt work there?

Now add a new mount with the disk with ext4 at /mnt/Parallel

It works! So it looks like LSI Parallel will work as long as it is not in slot 0.

Now let’s try NVMe:

Mount it with XFS this time at /mnt/NVMe:

Works great:

PowerCLI

So as the post above says there is a new cmdlet for this API called get-vmguestdisk

And it works on my Linux VM:

And you can grab a specific disk:

So these are the requirements:

Linux: Must not be using LSI logic parallel at slot 0 NVMe, LSI logic parallel, SAS, and PVSCSI work Requires VM tools 11.x ESXi/vCenter 7.0+ I haven’t tested LVM yet, but I have been told it is not supported.

Windows PVSCSI, SAS, or Parallel No NVMe at all Requires VM tools 11.x ESXi/vCenter 7.0+ Windows 2012 R2+ Volumes on top of storage spaces do not work. Note though it will still pull the drive letter and file system type, but it cannot map it to a disk.

