I have a VM (Windows Server 2008r2) with 3 virtual hard disks. 2 of the hard disks (C, D drives) were created in the same datastore as the VM when the VM was created. The 3rd virtual hard disk (E drive) was later added as an adjunct hard disk so the hard disk is in a separate datastore.
This VM will be decommissioned and I want to move its contents, for example files 1, 2, 3, ..., of the 3rd hard disk to another VM.
Instead of adding another hard disk to the new VM for these files, and then manually copying the files within the VM from 1 to the other, is there any easier way like attaching that 3rd virtual hard disk to the new VM so that the original files magically appear on my new VM?
If so, what would be the proper steps?
Thanks for any information provided.
Just add the existing vmdk to the new VM
When the old VM has no snapshots that can be done even when the new VM is running
Thanks for the response.
When I do this, does the old VM need to be offline or can this be done when both are live?
Assuming the VMDK is not shared. Best approach would be to Power OFF old VM, remove the VMDK and then add it to the new VM
The VMDK is not shared. So from what I understand then my steps would be:
1) Power off old VM
2) Remove Virtual Hard Disk from old VM
3) Add new Virtual Hard Disk to new VM using existing VMDK.
Thank you all for the information.
To move the hard disk from one VM to another VM.
1) Power off the VM from where the HDD need to be moved
2) Remove Virtual Hard Disk from VM
3) go to the other VM and right click and edit settings
4) go to hard disk option and add the existing VMDK.from the datastore.
5) power on the VM.
Yes that would be the steps
Is this a best practice though? I have a similar situation where I had to move some virtual disks between VMs. I did that using th above mentioned steps but the underlying names of the vmdk did not change to reflect the new VM it is pointing to now
In vSphere 5 you can again migrate the VM and all virtual disk to a different datastore folder and it will rename the virtual disks to be same name as VM and bring the VM and disk together. I do this all the time and then migrate the VM and disks back to original spot. Of course I always ensure I have a full backup of the data in case of any corruption.
I've often removed virtual disks from one VM and then added to another without shutting either VMs down. You can do this as long as there are no snapshots on the VMs. If the OS is windows 2008, I remove the Drive in Windows Disk Manager first, then remove in vSphere client . - Note the path of the vmdk first -then the vmdk will no longer be attached to the VM but will still reside in the VM's folder on its datastore. Then in the new VM, I go to add an existing disk and navigate to the original VM's datastore and add the vmdk - once it is added, I go into the Windows Disk Manager and scan disks for it to appear.
Then I will use Storage vMotion to move new VM and disks to a new location, this will bring the VM, existing disks and the new disk (from old VM's datastore) over to new area and give them all the same name as the VM. I will then move the whole VM and disks back. So in the end the newly added virtual disk will be in the same folder as its new VM. You can do this provided you have enough room on a different datastore. Also if using Windows Shadow copy or shares, you might have to remove Shadow copy of the Drive before moving the virtual disk and might have to recreate any shares. I think it keeps the security permissions intact.
Hi,
Sounds like you know what you are doing here in regards to moving a virtual hard drive from one VM to another VM, so I would like to ask you a question about this....
I have a VM which I need to blow away and create a new one to replace it. But, the customer would like us to keep the d: drive. I see how I can detach the drive. I see how I can add an existing drive and where to find it. But, if I detatched the d: drive, and then deleted the VM, would it delete the detatched hard drive since it's located in the same folder as the VM being deleted? The new VM will have the same name. So, I need to delete the old one before creating the new one. Please advise. Thank you.
The disk will remain in the <VMName Folder>, when you delete a VM from disk, only the connected disks are removed. Disconnected disks will remain on the datastore.
Example
VMname : Test
Datastore : DS001
- VM has 3 disks
On the datastore it would be something like this, with some other VM configuration files
DS001\Test\Disk1.vmdk
DS001\Test\Disk2.vmdk
DS001\Test\Disk3.vmdk
Now I remove disk 3 from VM but don't delete it from disk.
So the VM now has 2 connected disks (Disk1/Disk2)
Now I choose to delete the VM "Test" and delete it from disk, everything will be removed except DS001\Test\Disk3.vmdk this will remain on the datastore.