Hello friends. I 'll be right as every Wednesday to tell something new about XenServer.
Last week we learned how to manage our virtual machines from CLI and saw some more advanced features such as import / export VMs. Today we will enter more deeply and give you the clues so that you can implement a simple backup of your virtual machines.
Roughly what we will do today is to export a virtual machine using a snapshot to a local file and then import it to check it out . This time , so that we can export a virtual machine without having to stop and not affect our production environments.
I can outline the process thus:
Creating the snapshot
The snapshots are created with the command xe vm -snapshot vm = the " VM Name " and new- name- label = The name that has the snapshot parameters.
# Xe vm -snapshot vm = vmachine01 new- name- label = backup_vm01
If the virtual machine is Windows we can use the VSS support by :
# xe vm- snapshot- with- quiesce vm = vmachine01 new- name- label = backup_vm01
Once you run the above command will show output like this :
1e2661f0 - e94f - 0cac - f1ba - 4c59c9054e56 -> The UUID of the snapshot
We can list snapshots with :
# Xe snapshot- list
And we can see snapshots of a virtual machine with :
# Xe snapshot snapshot- list - of = UUID of the virtual machine
By default XenServer generates a snapshot when this is generated like a template "Template" . If we export the test at this time and we went back to what we would see in our XenCenter to import the result would be as you can see on the picture, a template of the original virtual machine. Despite it's interesting , we want to have a virtual machine to be used quickly, so transform this template into a virtual machine running a single step.
Transforming a template to a virtual machine
To transform a " template" to a virtual machine is simply changing a parameter with the xe template- param -set command.
# xe template- param -set is-a- template = false ha- always- run = false uuid = 1e2661f0 - e94f - 0cac - f1ba - 4c59c9054e56
export
We export our snapshot become virtual machine :
# xe vm -export uuid = 1e2661f0 - e94f - 0cac - f1ba - 4c59c9054e56 filename = / backup/vm01.xva
After the previous command, we will have our virtual machine exported to a file without stopping the original virtual machine. To be cleaner we can delete the VM from XenServer environment :
# xe vm -uninstall uuid = 1e2661f0 - e94f - 0cac - f1ba - 4c59c9054e56 force = true
import
Let's see how to restore this file . Xva to simulate the restoration of the virtual machine.
# xe vm -import filename = / backup/vm01.xva preserve = true
Once completed, and we again have our brand new virtual machine ready to be torn
Friends , have in your hands the tools for you to create scripts, do your backups, replicating machines between separate environments ( pools ) , and with this, I leave you until next week . I hope as always have told you something interesting about XenServer.