Dec 272012
 

Using a Mac with VMware ESX(i) is a pain, since very scarce support is available for the poor lovers of the apple 🙂

Luckily, once you enable ssh access on the hypervisor, the following commands come very handy:

ESXi 5.0

To power on a virtual machine from the command line:
  1. List the inventory ID of the virtual machine with the command:vim-cmd vmsvc/getallvms |grep <vm name>

    Note: The first column of the output shows the vmid.

  2. Check the power state of the virtual machine with the command:vim-cmd vmsvc/power.getstate <vmid>
  3. Power-on the virtual machine with the command: 

    vim-cmd vmsvc/power.on <vmid>

ESXi 4.1

To power on a virtual machine from the command line:
  1. List the inventory ID of the virtual machine with the command:vim-cmd vmsvc/getallvms |grep <vm name>

    Note: The first column of the output shows the vmid.

  2. Check the power state of the virtual machine with the command:vim-cmd vmsvc/power.getstate <vmid>
  3. Power-on the virtual machine with the command:vim-cmd vmsvc/power.on <vmid>

ESXi 4.0

To power on a virtual machine from the command line:
  1. List the inventory ID of the virtual machine with the command:vmware-vim-cmd vmsvc/getallvms |grep <vm name>

    Note: The first column of the output shows the vmid.

  2. Check the power state of the virtual machine with the command:vmware-vim-cmd vmsvc/power.getstate <vmid>
  3. Power on the virtual machine with the command:vmware-vim-cmd vmsvc/power.on <vmid>

 

ESX 4.0 and ESX 4.1

To power on a virtual machine from the command line:
  1. To list the path of all the virtual machines on the host:vmware-cmd -l
  2. Get the state of the virtual machine with the command:vmware-cmd <path to the VMX file> getstate
  3. Power on the virtual machine with the command:vmware-cmd <path to the VMX file> start

Enjoy.

Nov 082010
 

Today I successfully upgraded 4 ESXi hosts to VMware ESXi 4.1.

Since I do not have Virtual Center (they are mainly lab machines), I found very good hints about hot to do it from CLI via SSH.

And as usual, to avoid forgetting how I did it’s good moment to write down some notes about the process.

  1. First of all, access to your ESXi 4.0 with vSphere Client, power off all the VMs and put the host in maintenance mode.
  2. Second, from ESX console press ALT-F1 and type the word unsupported pressing <Enter> afterwards. Please note that you will not be able to see anything while you type. This is kind of secret word to enable Tech Support Mode (TSM) locally.
  3. It will prompt you for root’s password, after which you’ll get console shell access on ESXi. Now let’s enable SSH access to the machine.
  4. Vi the file /etc/inetd, search for ssh and remove the hash sign in front of the line:

    ssh      stream   tcp   nowait   root   /sbin/dropbearmulti   dropbear ++min=0,swap,group=shell -i –K60

  5. Find the process id of inetd and send a hiccup signal to it to reconsider updated configuration:

    ~ # pidof inetd
    4935
    ~ # kill -HUP 4935

  6. Access to the ESXi via SCP graphical interface (for example, using WinSCP.

  7. Locate datastore (normally under /vmfs/volumes/datastore-name) and create a directory there called, for example, upgrade-4.1

  8. Download the file upgrade-from-ESXi4.0-to-4.1.0-0.0.<somenumber>-release.zip from VMware Website and unzip it.

  9. Transfer the unzipped content into the directory you created on ESXi using scp.

  10. Access to ESXi host in SSH.

  11. Upgrade using commands:
    ~ # cd /vmfs/volumes/datastore1/upgrade-4.1
    ~ # esxupdate update –m metadata.zip

  12. Upgrade process will begin and conclude as shown below:
    image

  13. Reboot your ESXi

  14. Access with vSphere 4.1 client and exit from Maintenance mode.

  15. Restart your VMs.