Wednesday, August 13, 2008

Vmware: Reconcile Inventory with Disk

Interesting problem: As we know Linux / Unix don't like file names with spaces. The Vmware GSX, Server 2 Bate, and ESX have a Linux command line, but can support spaces in virtual machine names. This makes it difficult to reconcile VMs in the inventory against those on the storage.

Here's a one-line to handle it:
find -name *.vmx | 's/ /\\ /g' |
  xargs grep -i "display"

Output will show directory path, configuration filename, and inventory name for all VMs. If executed from /vmfs/volumes, it will span shared storage as well.

No comments:

Post a Comment