Virtual Machine in ESX 4.0 Virtual Infrastructure hangs when powering on as it attempts to relocate the VM to a different vSphere node


I experienced this recently with a server that had been inadvertently powered down. I restarted as normal via the vSphere client but the progress bar stuck at 1%.

Looking at the event details it stated that it was relocating the server within the infrastructure to a different node before actually powering on. I have no idea why as the original vSphere node had no issue or resource overload. The actual migration between nodes seemed to be hung.

To resolve this I restarted the VCenter server and was then able to successfully start the VM.

When you add a VM back into the vCenter inventory it is grayed out and in brackets states (invalid)


I had this recently when I made a change to the .vmx file, removed the VM from the inventory and then attempted to add it back in to the inventory to reinitialise.

Although I saw many explanations relating to services on the vSphere host and restarting the vcenter service on the vCenter server my issue was caused by a corrupt speech mark from copying and pasting configuration syntax into the .vmx file from notepad.

As soon as I checked and replaced the corrupt speech mark and added the VM back in it reinitialised successfully.

How to extend a boot or system volume on a Windows 2003 Server VMware Virtual Machine


You may have had a requirement to increase the space on the system drive of a Windows Server only to find that even though there is unallocated space to extend into you cannot extend the partition.

There is a neat workaround that I have tried a few times that works very well.

  • Power down the Virtual Machine
  • Make a backup copy of the Virtual Machine. Depending upon your flavour of VMware this can be done a number of ways. I like to browse the datastore using the VI client and take a full copy of the VM.
  • In the VI client edit the settings of the VM and increase the system partitions’ virtual hard disk to the desired setting and apply
  • Next you will need a second VM that is also running Windows 2003 Server. Power it down. In the VI client edit the settings of the second VM and Add a Hard Disk.
  • Select Use an existing virtual disk and Browse to the actual location of the first VM’s system disk
  • After you have added the disk and applied it, power up the second VM
  • Open Computer Management > Disk Management and you should see the system disk from the first VM with the accompanying Unallocated space
  • Run the Diskpart utility from Start > Run > Diskpart
  • Type list volume which displays all available volumes. Locate the volume to increase and type select volume x (where x is the volume number)
  • Finally type extend. If it has worked the message Diskpart successfully extended the volume should appear
  • Shutdown the second VM and in the VI client remove the hard disk from its configuration
  • Power on the first VM and voila, your system partition should now be fully utilising the allocated space

How to add space to a virtual disk on a VMWare virtual machine


  • Open VMware Infrastructure Client and connect to VirtualCenter or the ESX host
  • Right-click the virtual machine
  • Click Edit Settings
  • Select Virtual Disk
  • Increase the size of the disk and apply
  • On the virtual machine go to Disk Management in the Storage section of the Computer Management program
  • The disk size increase should now display as ‘Unallocated’
image001
  • Go to a command prompt and type DISKPART. Next type LIST VOLUME to see all the available volumes. Then, find the volume number of the disk from the other server. You can usually tell which one it is by the drive letter and size, and it should also be the one that is not a system volume
  • Type SELECT VOLUME <volume #> to select it. Once it is selected type EXTEND to extend it. If you enter LIST VOLUME again you will see the new size

image002

  • Exit out of the DISKPART utility. If you check in the Disk Management utility you will also see that the previously unallocated space it gone and the disk is now larger

image003

How to extend an LVM disk on a VMware virtual machine running a Linux OS


I have had a number of virtual linux machines that have run out of disk space and have found it difficult in the past to find one solution to increasing the virtual disk and expanding free space into a logical volume.

The most recent example was when I needed to extend from 8GB to 20GB and using the Gnome Partition Editor, Gparted, would not work as it doesn’t currently have LVM support.

There are some linux commands that get around this problem so first I extended the VMware virtual disk.

Expand the disk

Turn off the virtual machine that you wish to administer.

Open a command prompt and change directory to C:’Program Files’VMWare’VMWare Server or C:’Program Files’VMware’VMware Workstation depending upon what product you are running.

Run this command to expand the virtual disk: vmware-vdiskmanager -x 20GB "My harddisk.vmdk"

In my case I would like to increase the disk to 20GB so substitute your value. Include the full file location for the vmdk file and use quotes if there are spaces in the folder and/or filename

image001

The disk expansion should complete successfully

image002

Restart the VMware virtual machine and open a terminal session

Issue the df -k command which here shows us that the logical volume is at 100% usage

image003

We need to create a partition on /dev/sda

Type ls -al /dev/sda* which lists the existing partitions

image004

Our new partition will be /dev/sda3

Type fdisk /dev/sda then type’n’ for new partition

image005

Enter ‘p’ and 3 for the partition number (in this instance..obviously enter the partition number that matches your environment)

Also accept the default First and Last cylinders

image006

Finally type ‘w’ to write table to disk and exit

image007

If prompted to reboot then do so to ensure that the new partition table is written.

After a restart, type ls -al /dev/sda* to verify whether the new partition was created

image008

Now that the partition has been created we need to create a physical volume and add it to the volume group

Type pvcreate /dev/sda3

image009

Type vgextend VolGroup00 /dev/sda3

image010

We need to extend the logical volume

Type vgdisplay

image011

Which shows that there is 11.97GB free that we can add to the volume group

To extend the volume type lvextend -L+11.97G /dev/VolGroup00/LogVol00

I then had an error message that stated that there was ‘Insufficient free space: 384 extents needed but only 383 available’

After a quick search:

http://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/nofreeext.html

It seems that I needed to select a slightly smaller size. I selected 11GB rather than 11.97GB which solved this problem.

image012

Finally we need to resize the file system by typing resize2fs /dev/VolGroup00/LogVol00

image013

Type df -k to see if the new space is available to the logical volume

image014

The logical volume has now been resized and now has used space of just 35%!