Maj, 2012

...now browsing by month

 

Spring in the country

wtorek, Maj 8th, 2012

VMware Forum, Warsaw May, 15 2012

niedziela, Maj 6th, 2012

VMware Forum conference is to take place in Warsaw in 9 days. You can still register! There’s no access fee. It is going to be a great experience!

More information and registration form here: http://www.vmwareforum2012.com/Warsaw/

A quick PowerCLI to check for mounted physical CD

niedziela, Maj 6th, 2012

If you want to check all your VMs for mounted phsical CDs, here it goes:
$datacenters=get-datacenter
foreach ($dc in $datacenters)
{
$vms = get-datacenter -name $dc | get-vm
foreach($vm in $vms)
{
if(get-cddrive -VM $vm | where {$_.HOSTPATH -ne $null})
{
write-host $vm.name
write-host $vm.vmhost
write-host $dc.Name
write-host „”
}
}
}

Consolidating invisible snapshots

środa, Maj 2nd, 2012

Once in a while you may encounter a problem with snapshots and snapshot chains. Basically what can happen is when snapshots are not removed correctly you are likely to remain with your vistual disks pointing to your_drive-000001.vmkd file (therefore to differential disk) but in the snapshot manager you see no snapshots to remove. The command

vmware-cmd /vmfs/volumes/volume-UUID-or-name/virtual_machine/virtual_machine.vmx hassnapshot

returns 0.

When you browse the datastore you can see snapshot files. The problem begins when you are scarse on space on your datastore and the differential disk begins to grow. That can lead the the sitaution when there is no more space for the redo log and the machine becomes suspended. We remember that we can not use Storage vMotion for disks with snapshots in versions lower than 5. Remember also that if you unattach the disk from your VM, you cannot reattach it without manual modification of a vmx file. What can we do?

1. Find another datastore large enough to accomodate your disk. You can also add more space to your current datastore.

2. Check snapshot chain to make sure it is consistent. When you create a snapshot, it will result in the following files:

virtual_machine.vmdk virtual_machine-flat.vmdk virtual_machine-000001.vmdk virtual_machine-000001-delta.vmdk
virtual_machine-00000N.vmdk virtual_machine-00000N-delta.vmdk

Look at the base disk description file with:

cat virtual_machine.vmdk

and search for parentCID and CID. Both will be 8 hexadecimal characters in size. In case of your base disk as in our example, parentCID should have ‘ffffffff’ value. CID will be a random number. Note it down.

Look at the first snapshot description file:

cat virtual_machine-0000001.vmdk

and again find CID and parentCID. Make sure that parentCID is the same as CID of the base disk (as you noted it down a moment ago). Note down again CID of the first snapshot.

Repeat the operation down all the snapshots making sure that the chain CID-parentCID/CID-parentCID… is unbroken.

[Edit: 26.09.2012]
I’ve got a nice tip from Grzegorz on checking the chain easily with the command:

vmkfstools -q -v10 "your_disk.vmdk"

Thanks!

3. When you’re ready execute the following command:

vmkfstools -i source_file destination_file

This command will clone the disk but, what is more important in our case, it will consolidate the all snapshot and the base disk into one, nice vmdk file that can be moved, reattached to a VM, etc.

Make sure you point to your last snapshot description file as the source file. The destionation file can have whatever name you like and it can also lay on a different datastore as long as the datastore is seen by ESX of course.

The cloning proces can take some time depending on the disk size, storage speed, LAN/SAN speed, etc. so be patient.

4. When you’re done you can unattach the disk with snapshot from the VM and attach a new, cloned disk. Run the machine (you will have no space issue as now the disk with snapshot is unattached and not in use). Confirm that you can see your data and it is ok. Later on you can remove old drive files (description files and extents).

Useful links:

Using the snapshots (vmware.com)
VMWareKB: Consolidating snapshots
Fix broken or corrupt snapshot chain
VMware Communities – Resolving the CID mismatch error: The parent virtual disk has been modified since the child was created