Friday, July 24, 2015

Virtual Machine startup - shutdown with ESXi host

Today we got a request from client to configure some specific site server virtual machines to automatically start and stop with host as there is frequent power cut on these sites so client wanted to make sure these VMs would come online as soon as the host will power on. 

These are individual hosts so no HA or DRS configured means no need to worry about a case where you migrated VM to another host and this configuration became irrelevant. 

Note: BTW automatic startup is not supported with vSphere HA.

Configuring a VM to startup - shutdown with ESXi host is very easy,

Using #C client,
  • In the vSphere Client inventory, select the host where the virtual machine is located and click the Configuration tab.
  • Under Software, click Virtual Machine Startup/Shutdown and click Properties.
  • Select Allow virtual machines to start and stop automatically with the system, then Configure the startup and shutdown behavior.


 for detailed info about available optional settings, checkout VMware vSphere Documentation Center =>> Managing Virtual Machines section.

Using Web Client,
  • In the vSphere Web Client, navigate to the host where the virtual machine is located.
  • Select Manage > Settings.

  • Under Virtual Machines, select VM Startup/Shutdown and click Edit, edit settings dialog box will open,
  • Select Allow virtual machines to start and stop automatically with the system, then Configure the startup and shutdown behavior options.

That't it... :)


Saturday, July 4, 2015

vNIC upgrade issue: IP address already assigned to another adapter

Last week when I was upgrading VMware Tools and vNICs of few virtual machines, on two server 2003 machines faced this issue where I was not able to assign  previously assigned IP to newly added vNIC card, ended up with this error,
Some people say what a big deal its a very common post P2V or vNIC upgrade issue we face, agreed.

But I was surprised because even after following best practice during the network card upgrade why I still faced this issue. Here is what I did during the upgrade activity:
  • Updated VMware Tools and rebooted the VM 
  • Noted down the IP address then uninstalled the NIC card from device manager and powered off the VM 
  • Removed the old e1000/vmxnet vNIC and added VMXNET3 network card then powered on VM
  • Now tried to assign the previously assigned IP address to newly added vNIC
As I already removed the previous vNIC so was supposed to not face this issue anyways now come to fix. 

Most of the time we can fix the issue by simply running this env variable command 
set devmgr_show_nonpresent_devices=1, (leave the command prompt open)


and then delete the ghosted network adapters from Device manager (view=> show hidden devices),

 Now close the command prompt.

But what if you are still not seeing any ghosted network adapter in device manager ((view=> show hidden devices is checked).

If the above listed command does not work (a possibility in Windows Server 2000 and 2003), you may need to add this environment variable devmgr_show_nonpresent_devices to Windows and set its value to 1 in order view/delete the ghosted network adapter from device manager, to do so,
  • Right-click the My Computer desktop icon and choose Properties.
  • Click the Advanced tab and select Environment Variables.


    • In the System variables section, click New.


    • Set the Variable name to devmgr_show_nonpresent_devices and set the Variable value to 1 to enable the parameter.


    • Click OK to add the variable to Windows.
    Now open the Device Manager, Click View > Show Hidden Devices.
    1. Expand the Network Adapters tree 
    2. Right-click the dimmed network adapter, then click Uninstall.
    3. Once all of the grayed out NICs are uninstalled, assign the IP address to the virtual NIC.
    For more info refer to VMware KB# 1179 & Microsoft KB# 269155.

    Update, 05/10/2015: Last day when I was working on a Windows Server 2008R2 machine, found one may assign an already assigned IP to new vNIC even without removing the old ghosted vNIC. As the warning message suggest

    Once you would click Yes, then system will remove the conflicted static IP configuration from ghosted NIC card.
    But if you had assigned a name to vNIC and want to keep that same name for new network adaptor then you will have to first remove the old hidden vNIC.

    The above process works fine in case of MS server 2003 but its slightly different for Server 2008 and that might be very frustrating if you are not aware.

    The difference is, you need to start the command pormpt in elevated mode (run as Administrator) and after running the SET DEVMGR_SHOW_NONPRESENT_DEVICES=1 cmd you also need to open the device manager from same cmd by running START DEVMGMT.MSC command.

    Other steps are same.

     
    That's it.... :)


    Monday, June 29, 2015

    VMware Tools upgrade error, Unable to uninstall previous version

    Last week when I was upgrading VMware tools on some virtual machines, on one virtual machine tools update got failed as VMware Tools tried to uninstall the previous version but it failed because it couldn't reference the previous VMware Tools msi

    This is an issue with Microsoft Windows Installer and does not affect all Windows 2008/2003 systems. The problem can occur when the original install path from the older version of VMware Tools is invalid, such as if the install path was E:\ and that path is no longer present.

    To resolve this issue, one must perform a forced uninstall and reinstall of VMware Tools.

    To uninstall and reinstall VMware Tools:
    1. Right-click the virtual machine and click Guest => Install/Upgrade VMware Tools.
    2. Open a Console to the virtual machine and log into the guest operating system.
    3. Click Start > Run, type cmd, and click OK.
    4. Change the drive to your CD-ROM drive (For example, D:\), type setup /c and press Enter to force removal of all registry entries and delete the old version of VMware Tools.
    or 

    Note: For 64-bit guest operating systems, type setup64 /c instead.

    The above procedure will hardly take few seconds and once completed, Open My Computer, browse CD-ROM and install VMware tools using the GUI interface (This must be done from the GUI). 
    When the installation completes, reboot the guest operating system.

    Reference: VMware KB# 1012693. Aslo have a look at KBs # 10013542007298 for related error and fixes.

    That's It... :)


    Sunday, June 28, 2015

    How to add another NIC card to nested esxi host... ;)

    Some people might find this post funny but the fact is I was in the impression like to add another network card to my nested esxi hosts I will have to connect another physical NIC to my Lab machine. Earlier I had edited esxi VM setting and added another NIC card to esxi VM but was unable find it when checking via vSphere client so i thought, to add another NIC I will have to connect another NIC to my Lab machine first.

    Today I was looking for a supported cheap NIC card online but couldn't find one so approached one of my vExpert blogger friend Anjani Yadav for suggestion and when he said you don't need a second physical NIC card in order add another NIC to your nested lab hosts, simply edit the esxi VMs and add another NICs for VM settings, I sad already did with no luck the second thing he said....after adding the new NIC did you enable it from DCUI....then my impression was opsssssssss I missed this step ;)

    Anyways here are the steps to add one or more network cards to your nested Lab Esxi hosts.....
    • First edit the esxi vm and add one or more NICs,
    • Now login to Esxi DCUI and Select Configure Management Network => Network Adaptors

    here you will find your just added NIC cards, what you do here is, just enable them

    and click Enter to save.

    Then Esc, Y.

    Now using vSphere client login to you vC or directly to esxi host => Configuration, select Network Adapters and you will find your newly added Network Card available here.


    As you are seeing here, its in standby,


    Go to Properties, NIC teaming


    Select the standby NIC and click Move up....


    Update: As pointed out by Roshan Jha sir, alternatively we can do the same form vC itself.

    To do so, Select the esxi host where you have already added the Network Card => Configuration=> Networking => Go to Properties of vSwitch


    Now select Network Adapters and click Add,


    On next screen you will find newly added NICs,


    Select the newly added Network Cards from here and click Next........then one or more other clicks and you are done :)

    Finally I can brush up myself on vDS that I couldn't do earlier due to my wrong assumption of physical Network Card... :P

    Thats it..... :)


    Thursday, June 25, 2015

    VMware Workstation Tweaks

    Toady when i was looking for a way to disable swap file creation on VMware Workstation VMs, came across a very interesting blog post related to VMware Workstation tweaks, VMWARE PERFORMANCE ENHANCING TWEAKS. This could be very useful at times so thought of making a note of it.

    Tweak: Disable memory swap files .vmem files
    In the VMware settings.ini file add the following line
    mainMem.useNamedFile = "FALSE"
    Settings.ini file is located file either at C:\ProgramData\VMware\VMware Workstation\
    On Windows7:
    or C:\Documents and Settings\All Users\Application Data\VMware\VMware Workstation\folders, depending on your operating system. 
    For VMware Player: ## mainMem.useNamedFile = “FALSE” ## needs to be in the .vmx-file
    For VMware Fusion on Mac and Linux instead of mainMem.useNamedFile you have to set mainMem.backing flag.
    VMware Fusion Config files are located at:/Users/username/Library/Preferences/VMware Fusion/preferences and/Users/username/Library/Preferences/VMware Fusion/config
    mainMem.backing = "swap"
    Tweak: Disable log files for VM
    Open your .vmx file in a text editor and add the following line:
    logging = "FALSE"
    Alternatively you can specify a different location to store the log file, if you ever need them:
    log.filename = "c:\Windows\Temp\vm1.log"
    Tweak: Disable Unity Mode
    Unity might be a great feature for running virtual desktops  operating systems, but it is not the most useful for virtualizing server OS. An annoying sign of enabled unity is GuestAppsCache or caches folder with a large number of files in its appData-subfolder. In order to disable it for your VM, open your .vmx file in a text editor and add the following line:
    isolation.tools.unity.disable="TRUE"
    unity.allowCompositingInGuest="FALSE"
    unity.enableLaunchMenu = "FALSE"
    unity.showBadges = "FALSE"
    unity.showBorders = "FALSE"
    unity.wasCapable = "FALSE"
    Tweak: Disk & Memory I/O Performance Optimization
    Disable memory trimming:
    MemTrimRate = "0"
    Tweak: Disable page sharing:
    sched.mem.pshare.enable = "FALSE"
    Disable snapshots if you are not using them and prefer full backups,
    snapshot.disabled = "TRUE"
    Disable scale down of memory allocation:
    MemAllowAutoScaleDown = "FALSE"

    That's it.... :)