Hi Guys,
Im looking to create a backup/copy of a VM that runs in our production location. The VM(and its files) will then be transferred to our DR location where it can be restarted in the event that the primary site becomes unavailable.
I've had a quick look around and it appears that the best solution is to create a Powershell script that connects to VCenter using the VMware CLi and using the 'copy-datastoreitem' cmdlet copy the files to either the local machine on which the PS script is running or to an available UNC path. The files can then be transferred to the DR location and the VM manually registered with the VCenter running at the site to provide a failover service.
The question i have relates to the consistency of the image.
Do I need to 'switch off', 'quiesce' or 'snapshot' the VM's before I use the 'copy-datastoreitem' command? Are there any other considerations I need to be aware of? I've seen one article where the chap creates a snapshot before using the 'copy-datastoreitem' command and wasn't quite sure why he did that.
Any advice/helpful pointers would be appreciated.
Thank you.
Cossy
Making a snapshot creates a recovery point. During the copy operation the disks of the vm can still be changed. But if you have to start the vm on your DR site, you go to the snapshot first. That makes sure you start the vm with the disks you had when you created the snapshot.
After the copy operation you can remove the snapshot from the vm at the original site.
I hope this makes it clear to you?
I would create a snapshot before you make the copy to make sure that the disk is not changed during the copy operation.
Hi Robert,
Thanks for the prompt reply.
Taking a snapshot establishes a recovery point but still allows for updates to take place.
If I take a snapshot, I will end up with an additional disk/snapshot file which is also being continuously updated and I would ask the same consistency question about?
Am I misunderstanding something?
I simply want to be sure that the server will restart successfully in the new environment.
Cheers,
Cossy
Making a snapshot creates a recovery point. During the copy operation the disks of the vm can still be changed. But if you have to start the vm on your DR site, you go to the snapshot first. That makes sure you start the vm with the disks you had when you created the snapshot.
After the copy operation you can remove the snapshot from the vm at the original site.
I hope this makes it clear to you?
I see!
So...
1. Create a snapshot.
2. Copy the files from the datastore to a local file using copy-datastoreitem.
3. Copy the files from the local file to a datastore in the DR location using copy-datastoreitem.
4. Register the new server in the DR VCenter.
5. Restart the server from its snapshot.
Thanks again for your help.
Regards,
Cossy
You can copy files fom datastore to datastore directly. You don't need to copy vmdks to local file.
Copy-DatastoreItem vmstore:\<Datacenter>\<Datastore>\<path to file> vmstore:\<Datacenter>\<path>\