Thursday, June 16, 2011

Copying VM While Running

NOTE: I receive a checksum failure error during vm-import when following this method.

To copy a VM while it is still running:

  1. Create a snapshot
  2. Export as backup
  3. Import the backup
Here are the details:

Create a Snapshot
  1. ssh into XenServer
  2. run xe vm-snapshot vm="VM Name" new-name-label="Name the snapshot"
  3. when it completes write down the UUID returned
Export as Backup
  1. ssh into XenServer
  2. xe template-export template-uuid="UUID from step 3 above" filename="Name the .xva file"
  3. View progress in XenCenter
Import the Backup
  1. ssh into XenServer
  2. xe vm-import filename="Name the .xva file to import" sr-uuid="SR to restore it to"
Hints:

Use df -ha to view existing disks and available space
Use xe sr-list to find the sr-uuid needed in Import the Backup step 2.