VMware Cloud Community
bitboy00
Contributor
Contributor

Move VMDK while VM is running?

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.

Reply
0 Kudos
5 Replies
scott28tt
VMware Employee
VMware Employee

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


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
bitboy00
Contributor
Contributor

Okay, thank you ...

Yes, I had tried it in the wrong place.

However, it seems that we did not have the required license...

Now I have to take care of it.

Reply
0 Kudos
continuum
Immortal
Immortal

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


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

Reply
0 Kudos
mikedsz
Contributor
Contributor

bitboy00
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.

http://www.vmwarearena.com/vmware-converter-how-to-perform-p2v-and-v2v-migration/

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

https://linuxize.com/post/how-to-use-scp-command-to-securely-transfer-files/

Mike.

Reply
0 Kudos
larstr
Champion
Champion

bitboy00.

If you have your ESXi hosts connected to vCenter and the correct licensing you can easily move running VMs to different storage.

Lars

Reply
0 Kudos