Our datastore has been expanded. I would like to move some VMDK files to the new store now.
If the machine is running it won't work because the file is locked.
If the machine isn't running it works, but the machine doesn't know the new location of the VDMK file afterwards.
Actually, I assumed you could move running machines and wondered what I was doing wrong.
It would be nice to get some help so I can use it correctly.
Sounds like you might be manually moving files.
There is a migration capability which will do this for you: Migrate a Virtual Machine to New Storage in the vSphere Web Client
Here is a workaround for moving vmdks without vmotion feature but it requires some manual edits.
1. create a new snapshot
2. copy the basedisk to the new location with vmkfstools -i existing.vmdk new.vmdk
3. power off the VM
4. edit vmdk-descriptor of the new snapshot and point to the new path
5. power on VM
6. delete snapshot
7. if all is working you can now delete the old vmdk
Right, you will not be able to move the VMDK in the powered on state. It will be locked by the host, that is hosting the VM.
1) Storage vMotion is definitely an option provided you have the license, if you can afford a downtime, then you could go ahead with the storage migration in the powered off state.
You could also perform a VMDK clone, from the command line. The steps for the same are as below : VMware Knowledge Base
2) Once the clone is complete, edit the settings for the VM and repoint the disk to the new cloned disk for the VM.
3) Move operation involves a NFC, and if by any chance we have a network outage or network drop we may end up having broken files at the source and destination ( slight chances, if you would want to proceed with kindly take a backup of the VM).
Steps 1 and 2, would not mess sanity/consistency of the source disk and you could always fall back to the previous state.
3) Perform a V2V conversion. The V2V conversion can be performed when the VM is powered on, and it requires a free tool provided by VMware. The link is as below, to perform the steps for a V2V.
You could also try a copy operation, if you like from the datastore browser or even a SCP copy between the locations you would want via the CLI.
scp [OPTION] [user@]SRC_HOST:]file1 [user@]DEST_HOST:]file2