Create Free Blog | Random Blog »   Report Abuse | Login   

 

vSphere Virtual Machine Files and their Descriptions

September 6th, 2009

A virtual machine is a set of files under ESX or vSphere. Following are the files and their descriptions.

Vmname.vmdk This file is the header file or you can say it contains the metadata of the virtual machine. This file points to the data file (vmname-flat.vmdk) which contains real data. The size of this file is mostly in KB’s. All the  vmware commands need to be run on this file rather than on vmname–flat.vmdk. Also while creating a virtual machine ensure that there is no space in between the VM Name as this will create issues during execution of some commands latter.

 

If this file is accidentally deleted then please follow the information in the website below to recover this file.

http://www.itexperience.net/2008/03/03/howto-recreate-vmdk-files/

 

Vmname-flat.vmdk This file contains the real data of Virtual Machine Harddisk and size if also the same as the VM Hard disk.

 

If the vmname-flat.vmdk file gets deleted accidentally then the only way to restore is from backup. If you do not have backup then use recovery tools like GDB GetData Back or PCI FileRecovery.

 

Vmname.vswp This file is created when the VM is powered on and gets deleted when the VM is powered off.  The size of this file is same as the size of memory allocated. If the RAM of a VM is 1024MB and a reservation of 256MB is set then the .vswp size would be 768MB. If the RAM is 1024MB and the reservation is also set to 1024MB then this file will not get created. The .vswp file is created to allow for memory overcommitment on a ESX/vSphere server.

 

Vmname.vmx This is the configuration file of the VM. You can view the content using cat command.

 

Vmname.vmsd This file contains metadata of Snapshots. Here is one article where the person tried increasing the VMDK size without committing the snapshot and corrupted VMDK and VMSD file.  It also has information on how to recover the same.

http://www.vreference.com/2008/01/25/corrupted-vmdk-and-vmsd-files/

 

Vmname.nvram This is the file that stores the state of the virtual machine’s BIOS

 

Vmware.log, vmware-1.log, vmware-2.log, etc

This file contains information on the activity of the VM. This file can be useful in troubleshooting if you encounter problems

 

Of all these above mentioned files the important files for backup is vmname.vmdk, vmname-flat.vmdk and vmname.vmx. If you have these files then you can recreate the VM

 

 

Share SocialTwist Tell-a-Friend 

 

Posted by MyLab4vSphere | Filed in Virtual Machine Files | Comment now »

vSphere: Extend VMDK size without 3rd Party Tools

September 6th, 2009

There comes times when a C: Partition Size of a Virtual Machine inside vSphere 4.0 or on ESX 3.5 needs to be increased or extended. To do this you need the following.

1)     A temporary Virtual Machine to work with

2)     Vmkfstool (Built in to Service Console)

3)     DISKPART (Built in to Windows Server 2003)

 

You can also use Vmware Converter or some other 3 rd party tools to do the same, I found one good article which describes many more ways to do this.

http://vsphere-land.com/tips-tricks/re-sizing-virtual-disks

 

I decided to use the built in tools as many of our customers/clients do not allow using any 3rd party tools to do this.

 

Log in to as root to vSphere Server using Putty or similar utility. Change to the location where the .vmdk files are stored. In this case my current Win2003.vmdk is of 16GB Size and I want to increase it to 24GB.

 

 

 

Use the vmkfstools as below to Extend the vmdk size to 24GB. Although we supply Win2003.vmdk as the source HDD to be increased, as you can see below the file which actually gets increased is Win2003-flat.vmdk

 

 

 

 

 

 

 

 

 

 

 

Here is how it looks in the summary screen after the vmkfstools command is executed. You may need to refresh the storage usage if the changes are not displayed.

You cannot extend a C: partition using a DISKPART utility so you need to ensure that the system is turned off and then add that vmdk file to a temporary Virtual Machine as below.

 

After adding the VMDK to temporary Virtual machine, power on the same. Disk Management will show the partition as below. You can see the 8GB Unallocated partition. Also note that there is no drive letter for this new HDD.

 

 Go to command prompt and then type DISKPART. You will get the DISKPART command line. Type LIST VOLUME to see the available volumes and the number. Do note that still I have not provided any drive letter.

In the following screen you can see I got an error when I try to extend this partition and the reason was that I had not provided any drive letter to the partition. So after providing the drive letter I was able to extend it without any issue.

 

In the below screen you can see the drive size increased to 24GB almost.

Now turn off this Temporary Virtual Machine and remove the VMDK from its hard drive. Now turn on the Original Virtual Machine which had this VMDK as its main Hard Drive and C: Partition. During booting you may get a CHKDSK so just let it complete. After booting you can see the C: drive size is extended.

You can see the changes after the file size is extended. I had used the new feature in vSphere to Thin Provision my VMDK and hence even though you can see the Win2003-flat.vmdk has 24GB but still the total Folder size of the Virtual Machine is 1.7GB when powered off and after powering ON it went to 2.2GB as a result of the Swap file which has the same size as the 512MB Memory allocated for the virtual machine.

Share SocialTwist Tell-a-Friend 

 

Posted by MyLab4vSphere | Filed in Extend VMDK | Comment now »

vSphere Command Lines – Part I

July 21st, 2009

Listed below are commands that can be used in ESX/vSphere console. Some of them have been very useful to me but some other just for fun.

 

To List all the Virtual Machine System Files

[root@vsphere02 ~]# vmware-cmd -l

/vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/FT01/FT01.vmx

/vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx


To Get the Power state of VM

[root@vsphere02 ~]#  vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/FT01/FT01.vmx getstate

getstate() = off

 

[root@vsphere02 ~]#  vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/FT01/FT01.vmx getstate

getstate() = on


To create a snapshot, if revertsnapshot is specified it goes to the current snapshot.

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx createsnapshot ‘SNAP01′ ‘1st’ 1 1

createsnapshot(SNAP01, 1st, 1, 1) = 1

 

=> If the <quiesce> flag is 1 and the virtual machine is powered on when the

snapshot is taken, VMware Tools is used to quiesce the file system in the virtual

machine. Quiescing a file system is a process of bringing the ondisk data of a

physical or virtual computer into a state suitable for backups. This process might

include such operations as flushing dirty buffers from the operating systemʹs

inmemory cache to disk, or other higherlevel applicationspecific tasks.

=> If the <memory> flag is 1, a dump of the internal state of the virtual machine is

included in the snapshot. Memory snapshots take longer to create.

 

To check if a VM has a snapshot. 0 means no and 1 means yes. To remove all snapshot, instead of hassnapshot use removesnapshots

[root@vsphere02 ~]# vmware-cmd  /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/FT01/FT01.vmx hassnapshot

hassnapshot() = 0

 

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx removesnapshots

removesnapshots() = 1

 

Power on a VM from command line

Seems VMware Tools needs to be running for us to use the STOP command. start()=1 means it successfully sent the start signal. You can also use SUSPEND or RESET.

 

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx start

start() = 1

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx getstate

getstate() = on

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx stop

vim.fault.ToolsUnavailable: Cannot complete operation because VMware Tools is not running in this virtual machine.

 

If the VMware Tools is not started or not working or the server is in Hung mode then you may use the HARD way to stop the server. stop(hard)=1 means it successfully sent stop signal.

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx stop hard

stop(hard) = 1

 

[root@vsphere02 ~]# vmware-cmd  /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/FT01/FT01.vmx getid

getid() = 112

 

[root@vsphere02 ~]# vmware-cmd  /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/FT01/FT01.vmx getheartbeat

getheartbeat() = 59

 

[root@vsphere02 ~]# vmware-cmd  /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/FT01/FT01.vmx getheartbeat

getheartbeat() = 65

 

To get the uptime (Seconds) of OS on VM

[root@vsphere02 ~]# vmware-cmd  /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/FT01/FT01.vmx getuptime

getuptime() = 764

 

To check the status of HeartBeat of VM

The command can return one of the following:

0 – VMware Tools are not installed or not running.

1 – Guest operating system is responding normally.

5 – Intermittent heartbeat. There might be a problem with the guest operating

system.

100 – No heartbeat. Guest operating system might have stopped responding.

 

[root@vsphere02 ~]# vmware-cmd  /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/FT01/FT01.vmx gettoolslastactive

gettoolslastactive() = 1

 

The following command will show the product details

If product is specified, the return value is one of the following:

=> gsx – VMware Server or GSX Server

=> esx – VMware ESX

=> embeddedESX – VMware ESXi

=> vpx – VMware vCenter Server

=> unknown (unknown product type)

 

If platform is specified, the return value is one of the following:

=> win32-x86 – x86based Windows system

=> linux-x86 – x86based Linux system

=> vmnix-x86 x86 ESX/ESXi microkernel

 

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx getproductinfo product

getproductinfo(product) = esx

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx getproductinfo platform

getproductinfo(platform) = vmnix-x86

 

The following will show the Build, MajorVersion and MinorVersion

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx getproductinfo build

getproductinfo(build) = 164009

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx getproductinfo majorversion

getproductinfo(majorversion) = 4

[root@vsphere02 ~]# vmware-cmd /vmfs/volumes/48320651-c5176d12-c595-000c29e099d5/Win2003/Win2003.vmx getproductinfo minorversion

getproductinfo(minorversion) = 0

 

 

 

For more commands download vsp_40_vCLI.pdf from www.vmware.com

 

Share SocialTwist Tell-a-Friend 

 

Posted by MyLab4vSphere | Filed in Command Lines, vSphere | Comment now »

Install VMware vSphere on VMware Workstation 6.5.2

July 18th, 2009

The installation was simple and straightforward. Just follow the screenshot on the PDFs. And you have fully functional vSphere setup to test. You may need it to take certification or just to check and install latest patch. xtravirt.com has always been the first to put in steps to install ESX inside Workstation. Kudos to the team involved.

 

Install vSphere 4.0 or ESX 4.0, please download the PDF from below

 

http://xtravirt.com/xd10089

 

Install Hypervisor vSphere 4.0i or ESX 4.0i, please download the PDF from below

 

http://xtravirt.com/xd10090

 

Before trying to install vSphere, please note that it requires 2GB for RAM. If you cannot afford to give 2GB then please read the article below to know how to tweak the same.

 

http://www.yellow-bricks.com/2009/05/08/running-vsphere-within-workstation-will-take-up-a-lot-of-memory/

 

Enjoy setting up vSphere.

 

Posted by MyLab4vSphere | Filed in Installation, vSphere | 1 Comment »