How to backup your VMs in XenServer?

+1 vote
3,444 views
asked May 6, 2014 in Windows by sada (11,920 points)

How to backup your VMs in XenServer?

 

can you help me please 

 

How to backup your VMs in XenServer?

6 Answers

0 votes
answered May 6, 2014 by osky (126,020 points)
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.
0 votes
answered May 6, 2014 by sada (11,920 points)
Hello osky,in my virtualization environment do I have 3 servers included in a pool from which I manage backups. 
I have made ​​a script to generate images of me all the machines I have in production and then exported the image to a remote storage. 
 
The problem I have is that when erasing such pictures some of the virtual disks are housed in storage that I use for the machines so that over time the storage is full and I did not do more copies. Currently what I'm doing is that occasionally I connect to XenCenter and hand delete these records, but I would like to know what is due and if that could solve some way impact. 
 
Thank you very much for your help. The virtualization blog is one of the blog I use most every time I want to do something. Illegal? Doing an impressive job. My sincere congratulations.
0 votes
answered May 6, 2014 by osky (126,020 points)
Hi Sada, thank you very much for the comment so interesting. Depends in part on the XenServer version you're using, if you are using the 5.6 branch can fix it with: 
 
xe vbd-list vm-name-label = name VM 
xe vbd-param-set uuid = UUID_VBD other-config: owner 
 
The problem may be that the XAPI and have not been associated VDI well as launch the uninstall does not delete the snapshot disks. A mi with what you posted was solved me repeatedly. 
 
Interestingly also the following link: http://support.citrix.com/article/CTX123400 if you use other versions or not solved by what I said. 
 
Greetings!
0 votes
answered May 6, 2014 by sada (11,920 points)
First many thanks for the quick response, 
 
I use the version 5.6 Sp2, launching the first command I get the following information: 
 
# Xe vbd-list vm-name-label = "XXXXXXXX" 
uuid (RO): e1ac57f2-62a6-c103-97bb-a138ead6896e 
vm-uuid (RO): 3a329ef6-38c6-590b-e92e-926eb8820f90 
vm-name-label (RO): XXXXXXXX 
vdi-uuid (RO): 594c6874-c04e-445f-AD72-45ac15014fcf 
empty (RO): false 
device (RO): xvda 
 
uuid (RO): 69559c28-11af-a92d-EA54-4ceef60f8b68 
vm-uuid (RO): 3a329ef6-38c6-590b-e92e-926eb8820f90 
vm-name-label (RO): XXXXXXXX 
vdi-uuid (RO): 
empty (RO): true 
device (RO): xvdd 
 
so I can understand that the second disc is not the bbdd the XAPI, launching the second command have not gained anything, you posting how I throwing the second command: 
 
# Xe vbd-param-set uuid = 69559c28-11af-a92d-EA54-4ceef60f8b68 other-config: owner 
 
Might you confirm me if it is properly released? 
 
Thank you so much for your work!!
0 votes
answered May 6, 2014 by osky (126,020 points)
Hi Sada, thank you for reading :) 
 
The vbd-param-set other-config: owner will not show any output, just add in the other-config parameter flag owner. 
 
Filters with best pbd xe vbd-list vm-name-label = "XXXXXXXX" type = Disk and all you pop you add the flag owner. 
 
You will see the parameter you edited if you do: xe vbd-list vm-name-label = XXXXX params = other-config type = Disk 
 
Greetings!
0 votes
answered May 6, 2014 by sada (11,920 points)
THANK YOU, 
 
I've already started, (I take 9 months thing behind it). 
 
You've solved one of my regrets, AUGUST AND SLEEP!! 
...