Archive for the ‘VMware’ Category

VMware ESX – Another Snapshot Fix

Sunday, October 25th, 2009

As an update to this post, a snapshot chain could also become corrupt if for some reason the .vmsd file (snapshot definition file) does not get updated when a snapshot is taken. The result of this can be seen by running:
vmware-cmd <vm-name>.vmx hasnsapshot
and it returning blank, or by checking Snapshot Manager in Virtual Center and it being blank, however you know snapshots exist because when you check the VM’s .vmx file, it is referencing snapshot delta files not the parent vmdk.

The .vmsd file’s purpose is to maintain information about the snapshots on that VM. It is read by Virtual Center to get the snapshot name and chain details. It is also read by vmware-cmd in the above command.

The solution is is to first confirm that hte current snapshot CID / pCID chain and fix that if it is broken. Then remove the .vmsd file. Next, create a snapshot on the VM either through vmware-cmd or through Virtual Center (it’s best to do this logged into the ESX host directly rather than Virtual Center because we will also remove it from the host). Next, check the snapshot chain either in Virtual Center or using vmware-cmd, this time you should see hassnapshot = 1 and the fiull, correct chain in Virtual Center. Finally, if the chain is restored correctly, remove the snapshot chain as you would normally.

Popularity: 23% [?]

VMware ESX: Renaming a Virtual Disk

Sunday, September 20th, 2009

A VMware virtual disk is made up of two files, the disk descriptor (<name>.vmdk) and the disk content itself (<name>-flat.vmdk). Using Virtual Center, you can move virtual disk files around (i.e. folder to folder), but it will not let you rename them. To do this you have two options: mv or vmkfstools.

Using mv:
SSH to the ESX host, cd to the location of the virtual disk. Oh, if the disk was attached to a VM, that VM needs to be powered off. Type:
mv oldname.vdk newname.vmdk
mv oldname-flat.vmdk newname-flat.vmdk

Next, need to edit the descriptor file so it can locate the disk (you can use vi, pico, nano):
vi | pico | nano newname.vmdk – Locate the old name in the file and edit to match the new name. Write out the file.

Using vmkfstools:
vmkfstools can rename the files and update the descriptor all at once (command is all on one line):
vmkfstools -E /vmfs/volumes/path/to/oldname.vmdk
/vmfs/volumes/path/to/newname.vmdk

Finally, if the disk was attached to a VM, back in Virtual Center (or by editing the .vmx for the VM) edit settings for the VM and point it to the newly renamed virtual disk. You can then power on the VM.

Popularity: 19% [?]

VMware ESX – Fixing Broken / Corrupt Snapshot Chains

Thursday, September 17th, 2009

Have recently had to deal with a virtual machine regularly failing to remove snapshots via VCB. The VM has 3 VMDK’s connected to it and I’ve seen as many as 11 delta files per disk (through VCB and troubleshooting efforts, etc) – that’s 33 snapshot deltas in the working directory!

Anyway, what can happen is the snapshot chain gets corrupted somehow and needs to be consistent before ESX can remove commit the snapshots back into the parent VMDK. You can see this happen when you run vmware-cmd .vmx removesnapshots and it returns quite quickly with an error.

What to look at:
You need to go back through the VMDK chain and ensure that the parentCID and CID for each vmdk is intact and effectively makes a linked list of hex values that ties each delta to the next, all the way back to the parent disk.

How to look at it:
Open an SSH session to the ESX host, cd to the snapshot working directory for the VM in question (likely going to be the location of the VM’s .vmx config file).
ls -lah to check out the contents of the directory. We are looking for the *-00000X.vmdk files
Starting with the original VMDK (you can cat the .vmx file to find out where that is located), cat the .vmdk file to check out the first CID field (the parentCID for the original VMDK will be all f’s).
Take note of the CID then cat the next VMDK in the chain (i.e. the first delta’s VMDK file). The parentCID field should match the CID value you noted.
Rinse and repeat all the way up the chain.

How to fix it:
A broken link in the chain will be a VMDK that has the same parentCID as CID. Either field needs to be changed to something else (just change one letter or number is fine) then the corresponding file either up the chain or down the chain (depending on if you chainged parentCID or CID) also needs to be updated to complete the chain.
Then, run vmware-cmd .vmx removesnapshots again and it should commit correctly.

I know the above isn’t all that clear – writing from memory rarely is. Will try to update when I have an example to refer to. Note there are a lot of good examples at http://communities.vmware.com

Popularity: 100% [?]

VMware ESXi Install From USB

Tuesday, August 25th, 2009

Needed to install VMware ESXi from a bootable USB key as the HP server I’m working on has no optical media drive and the virtual media applet in HP iLO 2 disconnects the media (either CD or ISO) part way through.

Tried using UNetBootin, which worked to create a bootable USB but for some reason could not boot to the installer. Tried a bunch of different options at boot: but couldn’t get it to work.

Fortunately, Internet to the rescue: VMware ESXi – install from USB thumb drive

Extracted the ESXi ISO onto a formatted (FAT32) USB key (I used 4GB key) using WinRAR. Downloaded syslinux 3.82 and used it to create ldlinux.sys, changed ISOLINUX.CFG to SYSLINUX.CFG for the bootloader to find it, booted the server with the USB key – boots straight to ThinESX.

Popularity: 2% [?]

ESX 3.5 U3 To U4 Upgrade In A Nutshell

Friday, August 7th, 2009

This is a minor upgrade to ESX. It applies to any ESX release running VMFS3 (ESX 3.x). If you are upgrading to this release from VMFS2 (ESX 2.x), that’s a different story (see the upgrade guide [vmware.com]). Also, there is multiple ways you could do some of these steps, e.g. could use esxupdate for the hosts or Update Manager for VMware Tools, etc) – either way, the order is important:

  1. Upgrade the Virtual Center server first – this is to apply the updates to the database, update manager, new VI client, etc
  2. Upgrade the ESX hosts second – if the hosts are in a cluster, simply VMotion all the guests off the host (or send it into Maintenance Mode and let DRS do it if you have it setup fully automated), mount the upgrade image to the server (either CD, or remote console, etc). Reboot the server and boot from the upgrade image, select pretty much every default (it will detect the existing install and default to upgrading it). Once it’s finished, restart the server, check everything starts ok.

  3. Upgrade VMware Tools on the guests last – an upgraded version of VMware Tools is included in U4, the guests will detect the upgrade and will eventually need to have it installed. There’s no rush, VC will just note that VMware Tools is ‘out of date’ until it updates and the system tray icon will have a warning icon. This upgrade includes a few virtual hardware updates.

ESX 3.5 U4 release notes [vmware.com]

Popularity: 4% [?]