ESXi 4.1 – Moving a VM.

Leave a comment

March 22, 2012 by aubreykloppers

Hi Guys-’n-Girls

After having major problems with a DATASTORE that ran out of space and not being able to bring up a VM, I found an easy way moving a VM over DATASTORES.

BACKGROUND:

I have 2 DATASTORES, named DT1 and DT2.

  1. DT1 has 850GB space and
  2. DT2 (later added) has 1.8TB space.

vSphere has 2 VM’s, named LINUX1 and LINUX2.

  1. LINUX1 has 500GB SPACE in DT1 and later I added 400GB SPACE in DT2.
  2. LINUX2 has 200GB SPACE in DT1 and later I added 600GB SPACE in DT2.

I started running VEEAM and this creates VERY LARGE SNAPSHOTS on the DT1 DATASTORE.  This became a problem when the delta file was left behind on the DATASTORE and one of the VM’s could not start due to lack of space.
MOVING datastore attached to VM:

TASK COMMAND
STEP1: Get all VM’s on host vim-cmd vmsvc/getallvms
STEP2: Get datastores for a VM vim-cmd vmsvc/get.datastores <VM ID# – from STEP1>
STEP3: Move your datastore mv <source-dir> <dest-dir> 

NOTE: You can also cd to the source dir and move all the files into dest dir if you want to combine files into one dir.

STEP4: Remove form vSphere Right-click on VM and remove from inventory. 

NOTE: Only do this if your <source> is the physical VM and not attached storage.

STEP5: Import VM into vSphere vim-cmd solo/registervm <path to new>.vmx 

NOTE: See STEP4.

STEP6: Bring VM up. NOTE1: If this was not a physical VM, nothing else to do. 

NOTE2: If this was the physical VM. vSphere will ask you 3 questions.  Just answer the question accordingly.

I hope you guys find this helpfull.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: