A. Mikkelsen

VMware ESX scripts, commands, tools and other nice to know things that will make your virtualization days easier!!!!

Browsing Posts in White Papers

Yesterday I by mistake extended a disk on a VM that had snapshots.
Using vmkfstools.
Kind of like this thread (http://communities.vmware.com/thread/238035).

This resulted in the following PowerOn error:

Failed to power on Servername on Host in Cluster:

Cannot open the disk ‘/vmfs/volumes/LUN/Folder/VM.vmdk’
Reason: The parent virtual machine disk has been modified since the child was created

The server was a database server so I had no choice than to fix it.

I tried the following with no luck:

  • Reverting to snapshot didn’t help – (Don’t try this if you don’t have a good backup)
  • Shrinking the vmdk again using vmkfstools – (This has not been possible since ESX 3.0)

Then I tried to use VMware Converter to do a V2V and in the first try (all defaults) that didn’t help the VM started with a BSOD.I tried again using the Converter but this time I changed one default parameter.In the “View/Edit Options” tap, remove the check mark in “Reconfigure destination virtual machine” and click YES to the warning.Removing the reconfigure option saved my day.
The VM started and I was able to restore the latest files from backup.


Duncan Epping has released a great post on how to partition your ESX 4.0 (vSphere) using scripting and the grafical installer

http://www.yellow-bricks.com/2009/05/27/partitioning-your-esx-host-part-ii/

You cannot define the sizes of the /boot, vmkcore, and /vmfs partitions when you use the graphical or text installation modes. You can define these partition sizes when you do a scripted installation.

The ESX boot disk requires 1.25GB of free space and includes the /boot and vmkcore partitions. The /boot partition alone requires 1100MB.

The vmcore is created automatically by the installer

Primary:
/     - 5120MB
Swap  - 1600MB
Extended Partition:
/var  - 4096MB
/home - 2048MB
/opt  - 2048MB
/tmp  - 2048MB

Today when I needed to upgrade my VC database from MSSQL2000 to MSSQL 2005 i came upon these quick guides.

http://blog.core-it.com.au/?p=27

http://spininfo.homelinux.com/news/VirtualCenter/2008/01/06/Howto_Move_Migrate_Design_VC_DB_from_SQL2000_to_SQL2005__

Over the past few months we have seen a few Windows servers with a black screen.
Meaning

  • You can’t see the logon promt
  • You get a black screen when you connect with RDP

We found that the problem was caused by a change in the Windows color scheme.

The solution is to copy the color scheme from a simular Windows servers registry and add it the VM/server that has the problem using registry to connect to a remote server.

  1. On a simular windows server locate “[HKEY_USERS\.DEFAULT\Control Panel\Colors]” and export it to a file.
  2. Using the same Registry Editor connect to the remote server.
  3. Import the registry file just created or change the color scheme manually.
  4. Reboote the affected server to change the color scheme.

Default color scheme for a Windows 2003 server.
Default color scheme for a Windows XP.
Default color scheme for a Windows 2000 server.
Default color scheme for a Windows 2008 server.

But ESX as a VM with running VM’s is new.

It’s now possible to run ESX as a VM on an ESX server or in a Workstation.

See howto
http://www.vcritical.com/2009/05/vmware-esx-4-can-even-virtualize-itself/

Right after lunch today I had a host (3.5 U3) crach with a kernel panic.

It shouldn’t be a problem for clusters running HA, but on this cluster I had disabled HA bacause of an error and hadn’t had the time to depug :-( .
So my VM’s couldn’t be started on a new host and I’m not going to manually register 116 VM’s on another host – so I was forced to find a soultion.

I did a bit of googleing and found VMware KB10196.
I followed the steps and everything is now working – AND HA IS ENABLED :-)

This is the steps i followed:

  1. Reboot the host into “VMware ESX servere (Debug mode)”
  2. Log in with a user with root permissions and run the following commands.
    esxcfg-boot -p (reloads the PCI data)
    esxcfg-boot -b (sets up boot information)
    esxcfg-boot -r (refreshes initrd)
  3. Now just reboot the host.

After the reboot the host should work as normal. From the VC Client you can verify that the host is connected to VC.

After we have allowed Windows 2008 Servers in our VMware VI enviroment, we been having problems sysprepping Windows 2008 Server.
So here is a quick guide to sysprep a Windows 2008 server in a VMware VI enviroment.
(Use this workaround until VMware VI allows you run sysprep against a WIN2008 Server)

  1. Change the source or templates Guest Operating Systemsetting to “Vista (32 bit)” or “Vista (64 bit)” depending on the installation of the Windows 2008 server installation.
  2. Clone the VM or template and you are now able to customize your Win2008 server with sysprep.
  3. After the cloning is done Power On the new VM and let the customization complete.
  4. Shutdown the VM and change the Guest Operating Systemsetting back to “Windows Server 2008 (32/64 bit)”

The reason the above workaround works is that Vista and Server 2008 has sysprep build into the OS and the sysprep in both OS’s and are based on the same technology.

Read more here

http://www.vmwareinfo.com/2008/05/sysprep-windows-2008-in-vmware.html

http://communities.vmware.com/message/934733#934733

http://technet.microsoft.com/en-us/library/cc766514.aspx

Scott Drummond from VMware has made a super document describing how to read output from esxtop.

http://communities.vmware.com/docs/DOC-9279

Yesterday I by mistake added the VirtualCenter servers local Users group to a folder in VC with ReadOnly permissions.

This resulted in that I couldn’t delete or change any permissions on the folder.

To solve the problem do the following (On a MSSQL2000 – should be almost the same on MSSQL2005):

  • Open the SQL Server Enterprice Manager and browse to the VC_DB (or what you have called the VC database)
  • Locate the table VPX_ACCESS and right click it and choose Open Table -> Return all rows
  • In the buttom of the table you should be able to locate the wrong permissions entery – make a note of the ID.
    If you can’t find the user/group, you can browse the VPX_ENTITY table to locate ENTITY_ID you need.
  • Open the SQL Query Analyzer an choose the VC database
  • To delete the row that contains the wrong permissions run the below SQL code or modify it for you liking.
    To only delete row 221 from the table

    DELETE FROM esx.VPX_ACCESS WHERE ID = 211

    To delete all rows containing a specific user/group from the table

    DELETE FROM esx.VPX_ACCESS WHERE PRINCIPAL = 'your_user or group'

After you have deleted or updated all the permissions you need, you have to restart the VC server service before the changes will take effect.

Disclamer…..
All changes to the VC database should be avoided at all time.
Always make a backup of the database before making ANY changes to it.
All changes to the VC database using examples on this website is at your own risk.

A few weeks ago we were conducting a vRanger DR test of a VM (new host and new LUN).

The VM was restored succesfull, but when we powered it on we discovered that it for some unexplaned reason had lost the SCSI0:1 (100GB) and SCSI0:2(300GB) VMDK’s.
It had created two new 20GB VMDK’s instead.
We searched the LUN and found the two orginal *-flatvmdk files but not the descripter files.

Use Putty to identify the size of the *-flatvmdk file. ex. 100GB

ls -lah

From a VM (not running) create a new disk with the same size as the one you are missing. The name is not important.

Locate the newly created *.vmdk and *-flat.vmdk file. Copy the new *.vmdk file to the folder that contains the orginal *-flat.vmdk file.

cp rescue_me.vmdk /vmfs/volumes/mysan/rescued/rescued.vmdk

Use VI or NANO to change the following line as below from:
RW 419426200 VMFS “rescue_me-flat.vmdk”

To:
RW 419430500 VMFS “rescued-flat.vmdk”

Make sure that the name of the .vmdk file correspond to the SCSI*:*.fileName in the vmx file.
Now just power on the VM and the orginal disks are intac.

UPDATE
Today I found out that esXpress has created a website that can create a VMDK descriptor file.
http://www.esxpress.com/tools/wrapgen.php

Below is an exampel for the rescure_me-flat.vmdk file with a size of 100GB (107374182400 bytes)
esXpress WMDK descriptor file creator

This isn’t new!
But what is new, is that it’s now possible to run VM’s inside the hosts.

The performance isn’t the best, but it’s OK for testing.

Read the full article here.

Today i came accross this guide on howto move the Virtual Center database from one MSSQL server to another.

Read the full guide here..

I know that this guide will be usefull when i next week have to do just that.

Read my local copy here

Today i came accoss this handy little guide to boost performance of a VM.

  1. Disable the pre-logon screensaver:
    Open Regedit
    HKEY_USERS\.DEFAULT\Control Panel\Desktop
    Change the value of “ScreenSaveActive” to 0.
  2. Disable updates of the last access time attribute for your NTFS filesystem, especially for i/o intensive vm’s this is a real boost:
    Open CMD
    fsutil behavior set disablelastaccess 1
  3. Disable all visual effects:
    Properties on your desktop
    Appearance -> Effects
    Disable all options.
  4. Disable mouse pointer shadow:
    Control Panel -> Mouse
    Click on the tab “pointers” and switch “enable pointer shadow” off.

A big thanks goes to Yellow Bricks – Read the full guide here

VMware has released the LAB guide for PowerShell from VMworld 2008 – Cannes.

It is great for getting inspriation for scripts or just to learn how the PowerShell for VMware works.

Get it here form VMware.com
Or my local copy here.

Eric Siebert has writen a very good and explaining guide on how to troubleshoot snapshots on ESX 3.x.

Virtualization administrators can use snapshots on VMware ESX to travel back in time and figure out what went wrong with their virtual machines (VMs). But what do you do when your snapshots start acting funny? In this tip, we’ll troubleshoot potential problems that may come up when using snapshots on ESX.

Read it here or read my local copy.

Ever wanted a XP installation disc that only had the bare minimum of features and the smalest foot print?
The take a look at nLite and if you a a gamer also take a look at Game XP.

You can find a guide to both Freeware programs here.

Last week I created a new WinXP media including SP3 using nLite.
After installation of a new VM I discovered that the VM boots faster and that the foot print is alot smaller around 1.3 GB.

I will in future use nLite or vLite to trim all my WinXP, WIN2003 server and Vista installation medias with.
This will result in my DR of VM’s will take up less space.

I know disk storage isn’t expencive but I also move the DR to tape ;-)

Looking for a guide to upgrade your VMware ESX enviroment to ESX 3.5 and VC 2.5, then this guide from RTFM Education is a must read.

http://www.rtfm-ed.co.uk/?p=482

RTFM Education has released a quick guide for ESXi

Get it here
http://www.rtfm-ed.co.uk/?p=476

Frane Borozan has created a automated script based on VMware Converter to take a physical server and make fresh replica of it on VMware Server.

It is worth a look.

http://www.p2vbackup.com

A. Mikkelsen

Yellow-bricks.com has been so nice to update the smtp_send.pl script and host a copy of it.
You can find the latest version on his website

A. Mikkelsen

Powered by WordPress Web Design by SRS Solutions © 2010 A. Mikkelsen Design by SRS Solutions