Posts

Moving a virtual machine from one datastore to another

First thing you need to do obviously is make sure ESX can see both of your datastores.
Power off the virtual machine that you wish to copy.
SSH into the server using putty or like product.
go to /vmfs/volumes and go into the volume in which you want to move your data:
cd /vmfs/volumes/Datastore2
mkdir <Name of VM directory>
cd /
Now switch back to source datastore
cd /vmfs/volumes/Datastore1
cp *.* /vmfs/volumes/Datastore2/<Name of newly created VM directory>
Depending on the size of your datastore this obviously can take a very long time.
Now you have to register the new virtual machine
Go into virtual infrastructure, Click on the left the name of your ESX server, Go to the configuration tab.
From here go down to storage on the right hand column, double click the datastore in which you moved the VM. 
Browse until you get to the folder that you moved.  Find the vmx file right click on it and select add to inventory. 
Congratulations you are finished.