Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Did you try to connect on the ESX(i) directly and kill the process with 15 signal or worst case scenario 9 ? –  golja Jul 1 '12 at 12:57

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
1  
I equate this to "I had to slow down my bike so I used a stick in the spokes". Beware the potential problems. –  Tim Aug 14 '13 at 0:02

The answer depends on the version of vSphere you've got.

Step 1:First make sure you disable the automatic restart of VM's.

enter image description here

Step 2: enable the SSH console

From: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=8375637

To create a user in ESX host for using a SSH client:

Log in to the vSphere Client as a root user.
Click Users & Groups.
Right-click on a blank area and click Add.
Enter a username and password. Confirm your password.

Note: Starting in ESX 4.0, the password needs to be at least 
8 characters in length.

Select Grant shell access to this user and click OK.

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

service mgmt-vmware restart

Step 3b (Esxi only) Restart the VM client daemon

/etc/init.d/hostd restart

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.

share|improve this answer
    
thanks, I just needed the last part to make sure I could safely kill the vmkstools copy correctly. for me, this command line was slow and failed. –  FireDragon Sep 18 at 5:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.