Objective
The objective is to create a new snapshot of a XenServer virtual machine and later restore from this snapshot.
Requirements
Privileged access to XenServer’s command line.
Difficulty
EASY
Instructions
Identify VM’s UUID
First, we need to identify a VM’s UUID we wish to take a snapshot from. Use xe vm-list
to list all available VM:
# xe vm-list uuid ( RO) : 7371124f-7d4d-66b7-cbc7-a98b1457543e name-label ( RW): Debian Jessie 8.5 power-state ( RO): halted uuid ( RO) : bad8e456-df88-435d-ba12-3f0f6e54b2c6 name-label ( RW): Control domain on host: xenserver power-state ( RO): running
Take a snapshot
The UUID of the virtual machine we would like to take a snapshot is 7371124f-7d4d-66b7-cbc7-a98b1457543e
. We use this UUID as well as xe vm-snapshot
command to create a new snapshot with name Debian Jessie 8.5-Snapshot
:
# xe vm-snapshot new-name-label="Debian Jessie 8.5-Snapshot" vm=7371124f-7d4d-66b7-cbc7-a98b1457543e f100447b-09a0-7b4c-31c9-36b970ecc9dd
The snapshot has been created. You can list this snapshot using:
# xe snapshot-list name-label="Debian Jessie 8.5-Snapshot" uuid ( RO) : f100447b-09a0-7b4c-31c9-36b970ecc9dd name-label ( RW): Debian Jessie 8.5-Snapshot name-description ( RW): Installed via xe CLI
Restore from snapshot
Now we can restore from the snapshot. Please note that your VM will be halted as a result of the following linux command:
# xe snapshot-revert snapshot-uuid=f100447b-09a0-7b4c-31c9-36b970ecc9dd