Hi all,
I have a running VM in our production Site. I need to create a VM @ the DR site in the same datastore but using the exsisting disks the running VM is using
Can this be done ?
Rashida
Afaik this can not be done with the current VITK nor with the SDK.
What I think would be needed:
create a folder in the datastore for the new guest
copy at least the .VMX file to this folder
edit the folder and change at least the VMDK entries to point to the folder of the original guest
...and possible some further editing and/or copying
Wouldn't it be easier to:
1) clone the original guest
2) reconfigure the clone to point to the disks of the original guest
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can hot clone since ESX 3.5 U2, see the release notes http://www.vmware.com/support/vi3/doc/vi3_esx35u2_vc25u2_rel_notes.html#whatsnew.
[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org
That's correct, but I understood that the cloned guest should point to the disks of the original guest.
Kind of shared disks.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hmm...You could do that with RDM, couldn't you? Maybe that would only work for cluster quorum disks. I don't know that I would attempt to share the disk files if I were the original poster.
[PowerShell MVP|https://mvp.support.microsoft.com/profile=5547F213-A069-45F8-B5D1-17E5BD3F362F], VI Toolkit forum moderator
Author of the upcoming book: Managing VMware Infrastructure with PowerShell
Co-Host, PowerScripting Podcast (http://powerscripting.net)
Need general, non-VMware-related PowerShell Help? Try the forums at PowerShellCommunity.org
it looks like the poster is wanting to do a shared disk ..maybe for DR reasons...
Creating a clone will be a tidy option but then thats extra space needed for the cloned disk which will be deleted after point to the exsisting disk......If the poster has down time i think he is better doing this manually....
That's correct, but with RDM you loose some useful vmfs features and VCB support.
And it could be expensive in the number of LUNs that need to be defined.
Let's wait for a clarification of Rashida11.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
William Lam has a script for this, but it's meant to be run directly on the ESX system.
I'm not sure if everything William did can be done through the API (and thus through PowerShell). Anyone care to take a look?
If I understand his bash script correctly then he is doing something along the lines of what I said earlier.
He copies the VMX file to a new folder, edits the VMX file and then registers the clone.
As a condition, the master guest is not allowed to have snapshots nor RDMs.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
So the only tricky bit would be faithfully duplicating the VMX file.
With U2 you could do a hot clone, then when that's finished delete its disk, attach it to the existing disk and snapshot it, then you basically have a linked clone.
Without doing that I'm not sure if you could get a close enough copy of the VMX file.
I think the VITK Extensions could come in handy.
First use Copy-TkeDatastoreFile to copy the VMX file to a new folder and then Get-TkeVmxEntries to get the VMX entries.
Then write the updated entries back to the VMX.
We just need a New-TKEDatastoreFolder
Update: I missed the New-TkeDatastoreDirectory function.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Oh yeah, that would work.
Man whoever wrote that copy-tkedatastorefile thing was pretty smart.
A pitty I can't nominate the author for vExpert
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
There were about a million things I should have been doing today, but instead I decided to do the linked clone thing. You can find it in the extensions. It seems to work, I used it to clone 5 instances of an ESXi server running inside my ESX 4 server and they are all working great.
The semantics are as simple as
Get-VM vmtoclone | New-TkeLinkedClone -nClones N
and a few moments later you have a bunch of clones.
I did it against a powered off VM, but it should work against a powered on VM as well.
If anyone else tries it out, please let me know your experiences.
Thanks to William Lam for the idea BTW!