March 22, 2012 by aubreykloppers
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.
I have 2 DATASTORES, named DT1 and DT2.
- DT1 has 850GB space and
- DT2 (later added) has 1.8TB space.
vSphere has 2 VM’s, named LINUX1 and LINUX2.
- LINUX1 has 500GB SPACE in DT1 and later I added 400GB SPACE in DT2.
- 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:
|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.