VMware vSphere 4 SAN storage with multiple data-stores No vCenter
I shut-down a virtual machine and using the data-store browser did a copy/paste to copy the VM to a new datastore with additional space. The file copy performance was very poor, and due to time constraints I decided to cancel the copy task. However the copy task showing in the vsphere client can not be cancelled; the cancel option is disabled.
Currently I am not able to start the machine in it's original location as the disk files are locked for the copy. How can I abort the copy? I tried deleting the target directory but this did not abort the copy task.
The answer depends on the version of vSphere you've got.
Step 1:First make sure you disable the automatic restart of VM's.
Step 2: enable the SSH console
From: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=8375637
Step 3: log into ssh
Download putty from: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Step 3a (ESX only) Restart the VM client daemon
Step 3b (Esxi only) Restart the VM client daemon
Step 4 Wait for the vSphere client to reconnect
All of your VM's will still be running as before, only the vSphere app will restart.
With it the copy process will stop.
Bonus: a better way to copy
If you have thinly provisioned client, you can use the command-line tool
vmkfstools
like so:vmkfstools -i /vmfs/volumes/path_to_datastore/path_to_source_vm/vmname.vmdk /vmfs/volumes/path_to_dest_datastore/path_to_dest_vm/vmname.vmdk -d thin &
This will clone (
-i
) the vmdk file and make sure the destination file is thinly (-d thin
) provisioned. The&
at the end of the command will make sure you get your command prompt back.It will copy much faster than the GUI copy does, and you can cancel it easier.
canceling a vmkfstools copy
ps |grep vmkfstools
Note down the PID.kill 12345
Where 12345 is the first number listed on the vmkfstools line.
I managed to cancel the copy by creating a dummy virtual machine with a disk almost big enough to fill the datastore; shortly after the copy process caused the space to run out and cancelled itself.
If someone has a better solution I'll accept that as the answer, because that seems like a horrible way to stop a file copy and I'd like to know how to do it nicely.