Wednesday, November 16, 2011

vmware commands





Using this method, you will need some third party software (Ghost for example) which will transfer the data from the smaller drive to the larger drive and automatically resize to the larger partition. 

Personally, here's what I do.  In my example, I will use virtual disks that are named VMSmaller.vmdk and VMLarger.vmdk. This example assumes you know where the virtual disks are located on the ESX host and you are comfortable with basic Linux commands.

\- Once the data copy is complete, shutdown the guest.
\- Remove the virtual disk VMLarger.vmdk (trust me)
\- Log onto the ESX console
\- rename the virtual disk VMSmaller.vmdk to VMSmaller.bak
\- rename the virtual disk VMLarger.vmdk to VMSmaller.vmdk
\- Check the properties of the guest to verify the new drive size.

I then Power up the guest to make sure everything is ok.  If so, I go ahead and delete VMSmaller.bak.  If not, hey I've got something to fall back on.  This also helps prevents any possible issues with having virtual SCSI id's change on the guest.

Another way to increase the size of an existing virtual disk without having to create a larger second virtual disk is from the ESX console using the command ...
vmkfstools -X (for eXtend)

This is especially handy if available space is tight.  Say you want to increase a 50gb virtual drive to 75gb, but you don't have enough room to accomodate both the 50gb drive and the new 75gb drive using the above method.

For example, say I have an 8gb virtual drive named "VMTest.vmdk" that I want to increase to 10gb.  The virtual disk is located on a vmfs partition that I have labeled "esx-local_00".  To increase the size, perform the following:
\- Shutdown the guest
\- Log on to the ESX host
\- enter the following command ...
vmkfstools -X 10G esx-local_00:VMTest.vmdk

or you can use the full path of the virtual disk file
vmkfstools -X 10G /vmfs/esx-local_00/VMTest.vmdk
vmkfstools -X 10G /vmfs/vmhba2\:0\:0\:10/VMTest.vmdk (assuming that vmhba2:0:0:10 is the actual SCSI id of the volume I labeled "esx-local_00")

Once the disk is expanded, you will need either some third party software to expand the partition to use the new available space or (if using Windows 2k) change from a basic disk to dynamic disk.

More information on this method can be found by looking at the VMware Knowledge Base Answer ID 994.


resize file system:
lvextend, e2fsadm, dumpe2fs (Logical Volumn); md (RAID)

No comments:

Post a Comment