Category: Vmware

  • Raising A Virtual Machine From the Dead, or How I Screwed Up a VM and Resurected It

    Big-girl-zombie Something really nasty happened to me when I was working on storage vmotioning a ton of VMs onto new datastores. Basically I was not paying attention and tried to manually remove a Virtual Machine from the datastore using the datastore browser. This basically wiped out the .vmx and.vmdk files, leaving only the flat.vmdk file which could not be removed as thankfully it was in use.

    Anyway once I had realized what I had done, and got my mini panic attack out of the way, I found the following kb from Vmware. Reference it here.

    In order to get your VM back up and running you must create a matching .vmdk file to go with your flat.vmdk file. You do this using the command below. Note that you must know the size of your flat file in bytes.

    # ls -l vmdisk0-flat.vmdk (gives you size in bytes)

    Create a new virtual disk/vmdk file and a temp flat file.

    # vmkfstools -c 4294967296 -a lsilogic -d thin temp.vmdk

    Now delete the temp flat file that you just created.

    # rm temp-flat.vmdk

    Rename your temp.vmdk to match the name of the flat.vmdk from your vm

    mv temp.vmdk vmdisk0.vmdk

    Now vi the .vmdk file and point it to the flat file at the line below. You may also need to remove the last line if you did not use thin provisioning on the original vm.

    # Disk DescriptorFile
    version=1
    CID=fb183c20
    parentCID=ffffffff
    createType="vmfs"

    # Extent description
    RW 8388608 VMFS "vmdisk0-flat.vmdk"

    # The Disk Data Base
    #DDB

    ddb.virtualHWVersion = "4"
    ddb.geometry.cylinders = "522"
    ddb.geometry.heads = "255"
    ddb.geometry.sectors = "63"
    ddb.adapterType = "lsilogic"
    ddb.thinProvisioned = "1"

    Now you can go through the process of creating a new VM via VCenter, only instead of creating a new virtual disk, you use the vmdk file that you just created. You should then be able to power on your rescued VM.

    Scary!

     

  • ESXi 4.1 – Three Ways to Kill a Virtual Machine from the Command Line.

    Kill-buttonYou can log into an esxi 4.1 host and issue the following command to get a list of all running and registered VMs.

    # vm-support -x

    The vm-support command above will give you the World ID of the VM that you are looking to kill.

    # vm-support -X <World_ID> –w <dir>

    Another way to kill or shutdown a VM is with the vim-cmd command. Use the command below to find your vmid

    vim-cmd vmsvc/getallvms\

    Then kill it with…

    vim-cmd vmsvc/power.off <vmid>

    The nastiest and uncleanest method is to actually kill the unix PPID (parent process id) of the VM. Take a look at the command below and subsitute your VM’s name. The PPID is in bold.

    # ps | grep  <my_vm_name>
    10071899      vmm0:<my_vm_name>
    10051474 10071896 mks:<my_vm_name>   /bin/vmx
    10084243 10071896 vcpu-0:<my_vm_name> /bin/vmx

    Reference here

  • Other HA Configuration Error in ESXi and ESX cluster

    Big-frame-hammer Ran into the error below yesterday after rebuilding an ESX 4.0 host as ESXi 4.1 and attempting to enable HA after the newly rebuild ESXi host was added back to the cluster.

    Cannot complete the configuration of the HA agent on the host. Other HA configuration error.

    Since error message was dissapointingly unspecific, I called VMware Support and asked for their guidance. According to my tech, they are actually getting a lot of calls on this error, as may who are doing in place upgrades to esxi from esx are running into this.

    Specfically the error has to do with the fact that ESX has both a Service Console and VMkernel port used for host management, and ESXi only has a VMkernel port. To correct the issue and allow ESXi and ESX to place nice in the same cluster you must add the following.

    First under VMkernel Properties make sure that both VMotion and Management traffic have a check mark to indicate that they are enabled.

    Second right click on your cluster, and select VMware HA. Then click on Advanced Options and add the following 3 entries.

    das.allowNetwork1 = Service Console

    das.allowNetwork2 = VMkernel

    das. allowVmotionNetworks = true

    See screenshot below.

     

    Snapshot1

     

     

    UPDATE: Note that by default the original name of the management port group is,   Management Network. You must change this to VMkernel for this to work.

  • Quick and Dirty ESXi 4.1 Patching with esxupdate

    EyePatch Most if not all patching for ESX is usually done via Vmware Update Manager, however I downloaded a couple of zip files directly from HP to install when I rebuild my ESX 4.0 cluster as ESX 4.1.

    First step is to get your zip files on the ESX host (using scp in my case) and place the box in maintenance mode.

    Then using the command below I can determine which updates (or bulletins) will be installed.

    # esxupdate –bundle  hp-nmi-bundle-1.1.02.zip scan
    Applicable bulletins with updates are listed.
    —-Bulletin ID—– ——–Date——- —————-Summary—————–
    hp-nmi-driver-1.1.02 2010-09-13T01:08:28 HP NMI Sourcing Driver for VMware ESX/ES
    Esxupdate local cache states:
     Location: /tmp/updatecache
     Available space: 4087 [MB]

    Then I can do a dry run

    # esxupdate –bundle  hp-esxi4.1uX-bundle-1.0a.zip stage
    Unpacking cross_oem-hp-smx-provider_410.02… ######################################### [100%]

    Then I install

    # esxupdate –bundle  hp-esxi4.1uX-bundle-1.0a.zip update
    Installing packages :cross_oem-hp-smx-provi.. ######################################### [100%]

     

     

  • VCP Practice Test Questions Part 1

    Vcp-logo I figured that after a good solid two plus years of administering as well as designing, configuring and deploying Vmware ESX that i should get of my rear and finally work on getting my VCP.  A good number for Vmware positions require it nowadays as its a pretty valuable certification, one of the few left other than Cisco.

    Anyway, I have been taking a few practice tests and will be posting the questions that I either got wrong, or are pretty sure that I will not get correct if ever asked again.

     

    Q: To disable a service on a Host's Firewall, what command is used?

    A: esxcfg-firewall -d


    Q: Which ports does VMware Update Manager use?

    A: 8084, 9084, 9087


    Q: What command is used to list the current firewall rules on a Host?

    A: esxcfg-firewall -q


    Q: Strongest block ciphers available to ESX4?

    A: 256 bit AES


    Q: The /boot partition requires how much free space?

    A: 1.25GB


    Q: What command is used to close a port in the firewall of an ESX host?

    A: esxcfg-firewall -c


    Q: vCenter 4 Server minimum requirements are?

    A: 2GHz CPU, 3GB RAM, 2GB HD


    Q: What is the maximum amount of characters that a vCenter server name should not exceed?

    A: 16



    Q: What is the default security setting for ESX4?

    A: Medium with some outbound ports closed


    Q:The minimum amount of disk space required for vCenter Server?

    A: 2GB


    Q: The minimum recommended space for swap?

    A:600MB


    Q: What is the recommended size for the /home partition?

    A: 512MB


    Q: The maximum amount of RAM that a vSphere Guest can have is?

    A: 255GB


    Q: Distributed Power Management (DPM) requires which technology to be available on the NIC?

    A: WOL (Wake on LAN)


    Q: What is the maximum HBA's Supported on VMware vSphere 4 Host?

    A: 8
  • Enable Outbound SSH in ESX 4.x

    Windows-command-prompt-logo Apparently SSH outbound connections are not allowed in ESX by default, or are at least not allowed anymore by default. I say this as I have never had to allow ssh outbound before. Anyway, I ran into this today when attempting to scp a file off of one of my esx servers.

    To allow check if outbound ssh connections are allowed run the following command to see if sshClient is blocked.

    [root]# esxcfg-firewall -q sshClient
    Service sshClient is blocked.

    Run the following command to allow sshClient traffic.

    [root]#esxcfg-firewall -e sshClient

    I have previously posted how to configure the ESX firewall to allow SNMP and NTP here.  Its also important to note that this the process below does not allow ssh inbound connections. That is configured by allowing the sshServer service through the firewall. Commands below.

    [root]#esxcfg-firewall -e sshServer