• Save
Backup virtual machines with XenServer 5.x
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Backup virtual machines with XenServer 5.x

on

  • 390,766 views

Some thoughts about backup for virtual machines running on Citrix XenServer 5.x.

Some thoughts about backup for virtual machines running on Citrix XenServer 5.x.

Statistics

Views

Total Views
390,766
Views on SlideShare
388,375
Embed Views
2,391

Actions

Likes
20
Downloads
0
Comments
1

27 Embeds 2,391

http://werdna1222coldcodes.blogspot.tw 650
http://werdna1222coldcodes.blogspot.com 592
https://www.thomas-krampe.com 498
http://www.ewdna.com 480
http://werdna1222coldcodes.blogspot.hk 48
https://blog.thomas-krampe.com 23
https://thomas-krampe.com 19
http://www.betweenwires.com 19
http://www.slideshare.net 11
http://www.thomas-krampe.com 9
http://blog.thomas-krampe.com 7
https://thomas-krampe.de 6
http://webcache.googleusercontent.com 5
http://feeds.feedburner.com 5
http://wiki.simplexi.com:8080 4
http://betweenwires.com 3
http://werdna1222coldcodes.blogspot.ca 2
http://werdna1222coldcodes.blogspot.ch 1
http://werdna1222coldcodes.blogspot.fr 1
http://werdna1222coldcodes.blogspot.com.au 1
http://werdna1222coldcodes.blogspot.de 1
http://werdna1222coldcodes.blogspot.jp 1
https://wiki.thomas-krampe.com 1
http://cursos.itesm.mx 1
http://wiki.simplexi.com 1
http://werdna1222coldcodes.blogspot.com.br 1
http://werdna1222coldcodes.blogspot.it 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • it is very useful for Xenserver
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Today I would like to talk about backup of virtual machines under Xenserver 5.5. <br />
  • Since the first customer asked me for a backup solution, my first thoughts have been - for what. We have unattend setups, OS Rollout Tools, Provisioning Services and some other nice tools to re-deploy a crashed server. So a backup only for the VM&#x2018;s might be useless. But this customer have a lot of P2V Machines which are not easy to recover and in addition it&#x2018;s it might be faster to restore a backup then rebuild the machine from the scratch. So that are valid arguments and today I like to share my new thoughts. <br />
  • Since the first customer asked me for a backup solution, my first thoughts have been - for what. We have unattend setups, OS Rollout Tools, Provisioning Services and some other nice tools to re-deploy a crashed server. So a backup only for the VM&#x2018;s might be useless. But this customer have a lot of P2V Machines which are not easy to recover and in addition it&#x2018;s it might be faster to restore a backup then rebuild the machine from the scratch. So that are valid arguments and today I like to share my new thoughts. <br />
  • Since the first customer asked me for a backup solution, my first thoughts have been - for what. We have unattend setups, OS Rollout Tools, Provisioning Services and some other nice tools to re-deploy a crashed server. So a backup only for the VM&#x2018;s might be useless. But this customer have a lot of P2V Machines which are not easy to recover and in addition it&#x2018;s it might be faster to restore a backup then rebuild the machine from the scratch. So that are valid arguments and today I like to share my new thoughts. <br />
  • Since the first customer asked me for a backup solution, my first thoughts have been - for what. We have unattend setups, OS Rollout Tools, Provisioning Services and some other nice tools to re-deploy a crashed server. So a backup only for the VM&#x2018;s might be useless. But this customer have a lot of P2V Machines which are not easy to recover and in addition it&#x2018;s it might be faster to restore a backup then rebuild the machine from the scratch. So that are valid arguments and today I like to share my new thoughts. <br />
  • Since the first customer asked me for a backup solution, my first thoughts have been - for what. We have unattend setups, OS Rollout Tools, Provisioning Services and some other nice tools to re-deploy a crashed server. So a backup only for the VM&#x2018;s might be useless. But this customer have a lot of P2V Machines which are not easy to recover and in addition it&#x2018;s it might be faster to restore a backup then rebuild the machine from the scratch. So that are valid arguments and today I like to share my new thoughts. <br />
  • Manual backups are very easy to create. But I like to implement something which can run automaticly without any manual task. And in addition I don&#x2018;t want to shutdown the VM&#x2018;s before running the backup. <br />
  • To draw up a solution for this customer I got a big budget - which was near ZERO or fewer. So I first take a look on what Citrix put me in the Box. I put all the commercial solutions at the end of the queue and take a look at everythig free of charge first. Manual Backup are not an option, so I focused only automated backups via scripting. <br /> <br /> <br />
  • To draw up a solution for this customer I got a big budget - which was near ZERO or fewer. So I first take a look on what Citrix put me in the Box. I put all the commercial solutions at the end of the queue and take a look at everythig free of charge first. Manual Backup are not an option, so I focused only automated backups via scripting. <br /> <br /> <br />
  • To draw up a solution for this customer I got a big budget - which was near ZERO or fewer. So I first take a look on what Citrix put me in the Box. I put all the commercial solutions at the end of the queue and take a look at everythig free of charge first. Manual Backup are not an option, so I focused only automated backups via scripting. <br /> <br /> <br />
  • To draw up a solution for this customer I got a big budget - which was near ZERO or fewer. So I first take a look on what Citrix put me in the Box. I put all the commercial solutions at the end of the queue and take a look at everythig free of charge first. Manual Backup are not an option, so I focused only automated backups via scripting. <br /> <br /> <br />
  • For Windows VM&#x2018;s it&#x2018;s possible to use the Microsoft Volume Shadow Copy Service. <br /> In XS 5.5 the snapshot function has no &#x201E;revert from Snapshot&#x201C; option, so the restore is is not a One-Click restore. <br /> <br />
  • For Windows VM&#x2018;s it&#x2018;s possible to use the Microsoft Volume Shadow Copy Service. <br /> In XS 5.5 the snapshot function has no &#x201E;revert from Snapshot&#x201C; option, so the restore is is not a One-Click restore. <br /> <br />
  • The next descission is the placement of a script, which also appoint the scripting language and the way the script should work. <br />
  • The next descission is the placement of a script, which also appoint the scripting language and the way the script should work. <br />
  • The next descission is the placement of a script, which also appoint the scripting language and the way the script should work. <br />
  • The next descission is the placement of a script, which also appoint the scripting language and the way the script should work. <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • Very easy.We can then create a new VM from snapshot (Template), we can create a Template from snapshot, we can export the snapshot as a template and we can delete the snapshot. In some cases we have to reclaim the disk space from deleted snapshot by using the coalesce-leaf command. -> CTX123400 <br />
  • If your VM doesn&#x2018;t support Snapshots with quiesce there will be an error message VM_SNAPSHOT_FAILED &#x201E;Quiesce snapshots not supported&#x201C; <br /> After you run successful a vm-snapshot... command you get the as output which can be used after in the template-param-set command. <br /> Never export the snapshot to the filesystem of Dom0 <br /> <br /> <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • But sometimes I&#x2018;m lazy and before I start writing code I try Google (Google is your friend). <br />
  • But sometimes I&#x2018;m lazy and before I start writing code I try Google (Google is your friend). <br />
  • But sometimes I&#x2018;m lazy and before I start writing code I try Google (Google is your friend). <br />
  • You don&#x2018;t have to write off the Links from the following slides. At the end of this presentation I have a special link where you can find all the necessary informations and links to the introduced scripts. <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Backup virtual machines with XenServer 5.x Presentation Transcript

  • 1. Virtual Machine Backup on Citrix XenServer 5.5 Thomas Krampe 1
  • 2. Virtual Machine Backup on Citrix XenServer 5.5 Thomas Krampe 1
  • 3. Overview In some cases it might be very usefull to backup your virtual machines running on a Citrix XenServer. 06/06/10 © 2010 Thomas Krampe 2
  • 4. Overview In some cases it might be very usefull to backup your virtual machines running on a Citrix XenServer. There are several ways of backing up virtual machines (VMs). At a very high-level, there are two major categories for VM backups: 06/06/10 © 2010 Thomas Krampe 2
  • 5. Overview In some cases it might be very usefull to backup your virtual machines running on a Citrix XenServer. There are several ways of backing up virtual machines (VMs). At a very high-level, there are two major categories for VM backups: Cold Backups Hot Backups Offline Online 06/06/10 © 2010 Thomas Krampe 2
  • 6. Introduction Offline and Online backups are supported in Citrix XenServer through XenCenter as well as through scripting from the command-line interface (CLI). The primary focus of this presentation are scheduled hot backups, whereby virtual machines can be backed up without incurring downtime. 06/06/10 © 2010 Thomas Krampe 3
  • 7. Introduction Offline and Online backups are supported in Citrix XenServer through XenCenter as well as through scripting from the command-line interface (CLI). The primary focus of this presentation are scheduled hot backups, whereby virtual machines can be backed up without incurring downtime. 06/06/10 © 2010 Thomas Krampe 3
  • 8. What‘s in the Box There are also a lot of commercial applications and solutions out there for doing this job (some links for more information at the end). 06/06/10 © 2010 Thomas Krampe 4
  • 9. What‘s in the Box There are also a lot of commercial applications and solutions out there for doing this job (some links for more information at the end). But let‘s see what Citrix put in the box. 06/06/10 © 2010 Thomas Krampe 4
  • 10. What‘s in the Box There are also a lot of commercial applications and solutions out there for doing this job (some links for more information at the end). But let‘s see what Citrix put in the box. - Manual Exports through XenCenter and CLI - Manual snapshots through XenCenter and CLI - Scripted snapshots through XenAPI or CLI 06/06/10 © 2010 Thomas Krampe 4
  • 11. What‘s in the Box There are also a lot of commercial applications and solutions out there for doing this job (some links for more information at the end). But let‘s see what Citrix put in the box. - Manual Exports through XenCenter and CLI - Manual snapshots through XenCenter and CLI - Scripted snapshots through XenAPI or CLI 06/06/10 © 2010 Thomas Krampe 4
  • 12. Scripted Snapshot XenServer VM snapshots can be made very simple from either the XenServer (remote) CLI or through a XenServer API call. Snapshots created in this way can use the Citrix VSS provider for Windows VMs, which results in an application-consistent snapshot. 06/06/10 © 2010 Thomas Krampe 5
  • 13. Scripted Snapshot XenServer VM snapshots can be made very simple from either the XenServer (remote) CLI or through a XenServer API call. Snapshots created in this way can use the Citrix VSS provider for Windows VMs, which results in an application-consistent snapshot. Pros: • Fast • Requires minimum of storage space • Customizable to specific business needs Cons: • Requires additional knowledge of CLI or XenAPI • More complicated file-level restoration 06/06/10 © 2010 Thomas Krampe 5
  • 14. Script Placement There are two possible locations where we can execute our scripts. 06/06/10 © 2010 Thomas Krampe 6
  • 15. Script Placement There are two possible locations where we can execute our scripts. 1. On the Administrator Workstation - Windows Workstation with installed XenCenter - VB Script for the logic - Scheduled Tasks for automation 06/06/10 © 2010 Thomas Krampe 6
  • 16. Script Placement There are two possible locations where we can execute our scripts. 1. On the Administrator Workstation - Windows Workstation with installed XenCenter - VB Script for the logic - Scheduled Tasks for automation 2. On the XenServer - XenServer Domain0 - Shell or Python Scripts for the logic - Linux cron for automation 06/06/10 © 2010 Thomas Krampe 6
  • 17. Visual Basic Scripts Advantages - Running on Windows - Use Visual Basic Script which is easy to use - Can create backups in the local files system of the Workstation Disadvantages - Workstation has to be „always on“ - Network connection to Xenserver and maybe Storage required 06/06/10 © 2010 Thomas Krampe 7
  • 18. Shell or Python Scripts Advantages - Running on Domain0 Linux - Very reliably with cron - Server is in most cases „always on“ - Network connection to Storage is always there Disadvantages - Linux and Bash or Python knowledge required - External Storage mandatory required - Need Dom0 ressources while running 06/06/10 © 2010 Thomas Krampe 8
  • 19. Preparation Before we can start we have to install an important piece of Software on our virtual machines running Microsoft Windows. To perform quiesced snapshots using Microsoft Volume Shadow Copy Service we have to install the XenServer VSS Provider first. Citrix provide us this piece of Software in the folder in which the XenTools are installed, normaly under %SystemDrive%%Program Files%CitrixXenTools. Just execute the batch script install- XenProvider.cmd. 06/06/10 © 2010 Thomas Krampe 9
  • 20. Preparation Before we can start we have to install an important piece of Software on our virtual machines running Microsoft Windows. To perform quiesced snapshots using Microsoft Volume Shadow Copy Service we have to install the XenServer VSS Provider first. Citrix provide us this piece of Software in the folder in which the XenTools are installed, normaly under %SystemDrive%%Program Files%CitrixXenTools. Just execute the batch script install- XenProvider.cmd. If you uninstall the XenTools quiesced Snapshots are not longer available. After re-installing XenTools you have to install the XenServer VSS Provider again. For an uninstall of the VSS Provider simply execute the uninstall-XenProvider.cmd. 06/06/10 © 2010 Thomas Krampe 9
  • 21. Preparation If we use a Windows VM to create snapshots we have to keep in mind that, by default VMs only have access to their own snapshots. 06/06/10 © 2010 Thomas Krampe 10
  • 22. Preparation If we use a Windows VM to create snapshots we have to keep in mind that, by default VMs only have access to their own snapshots. XenServer does a security check to prevent a VM from importing another VMs disk without authority. Because in this scenario the VM must have access to the snapshots of other VMs, we need to modify the following parameter: 06/06/10 © 2010 Thomas Krampe 10
  • 23. Preparation If we use a Windows VM to create snapshots we have to keep in mind that, by default VMs only have access to their own snapshots. XenServer does a security check to prevent a VM from importing another VMs disk without authority. Because in this scenario the VM must have access to the snapshots of other VMs, we need to modify the following parameter: xe vm-param-set other-config:snapmanager=true uuid=<uuid of VM used for backup> 06/06/10 © 2010 Thomas Krampe 10
  • 24. How to create a manual backup using XenCenter Before we start scripting, just a small look on how we can do this manually. To create a snapshot in XenCenter just select the VM and go to the Snapshot Tab. Now click the „Take Snapshot“ Button. 06/06/10 © 2010 Thomas Krampe 11
  • 25. How to create a manual backup using the CLI Create Snapshot with quiesce xe vm-snapshot-with-quiesce vm=<VM UUID> new-name-label=Backup Create Snapshot without quiesce (normal snapshot) xe vm-snapshot vm=<VM UUID> new-name-label=Backup Remove the Template flag from the snapshot xe template-param-set is-a-template=false uuid=<SNAPSHOT UUID> Export the snapshot to backup share xe vm-export uuid=<SNAPSHOT UUID> filename=<SHARE/file.xva> Delete Snapshot from XenServer Host to safe space on SR xe vm-uninstall uuid=<SNAPSHOT UUID> force=true 06/06/10 © 2010 Thomas Krampe 12
  • 26. Backup automation Manual backups work great, but we want an scheduled, automated live VM backup. Before start coding, let‘s take a look at the features the script should have in addition. 06/06/10 © 2010 Thomas Krampe 13
  • 27. Backup automation Manual backups work great, but we want an scheduled, automated live VM backup. Before start coding, let‘s take a look at the features the script should have in addition. 06/06/10 © 2010 Thomas Krampe 13
  • 28. Backup automation Manual backups work great, but we want an scheduled, automated live VM backup. Before start coding, let‘s take a look at the features the script should have in addition. 1. External source for VM‘s to backup 2. Quiesced Snapshots (if possible) otherwise normal 3. Logging capabilities 4. External storage mount / dismount 5. Export snapshots to a network share 6. Clean up used Storage repository 06/06/10 © 2010 Thomas Krampe 13
  • 29. What to do? I don‘t want to reinvent the wheel, so I found three great community created scripts. 06/06/10 © 2010 Thomas Krampe 14
  • 30. What to do? I don‘t want to reinvent the wheel, so I found three great community created scripts. Example 1: Visual Basic Script Example 2: Bash Shell Script Example 3: Python Shell Script 06/06/10 © 2010 Thomas Krampe 14
  • 31. Example 1: Visual Basic Script The first script I found comes from Jeff Riechers and is based on Visual Basic Script. The script is published in the Citrix Community Forum. http://forums.citrix.com/thread.jspa?threadID=250128&tstart=0 The script is very good documented and supports quiesced snapshots if possible, 64bit Windows and is configureable with parameters. Make sure that you read the full thread, there are a lot of usefull hints inside. 06/06/10 © 2010 Thomas Krampe 15
  • 32. Example 2: Bash Shell Script The second script comes from Andy Burton and is a bash shell script. You can find this usefull script on the following website: http://www.andy-burton.co.uk/blog/ The script is also very good documented and supports quiesced snapshots if possible and is configureable with a configuration file. You find a lot of enhancements like mounting / dismounting CIFS shares and clearing old backups. 06/06/10 © 2010 Thomas Krampe 16
  • 33. Example 3: Python Script The third script comes from David McArthur and is a Python script. You can find this script on the following website: http://community.citrix.com/display/xs/Zero-Downtime+Limited-Space+Backup The python API is used to gather metadata about the VM, its disks, and its network interfaces. The metadata is written to plain text files. To restore, a new VM is created and given the memory and CPUs settings stored in the metadata.  Then the VIF and disks are restored with the stored images being written to the new lvm volumes. Currently, Windows servers are not supported in this version, only Linux VMs and the XenServer instance, itself. 06/06/10 © 2010 Thomas Krampe 17
  • 34. My Results 06/06/10 © 2010 Thomas Krampe 18
  • 35. My Results All of these three example scripts do their job as expected. 06/06/10 © 2010 Thomas Krampe 18
  • 36. My Results All of these three example scripts do their job as expected. 1. VB Script In my opinion the best way to create backups. If we install a virtual Windows machine as a backup appliance with XenCenter we can avoid the disadvantages (always on etc.) 06/06/10 © 2010 Thomas Krampe 18
  • 37. My Results All of these three example scripts do their job as expected. 1. VB Script In my opinion the best way to create backups. If we install a virtual Windows machine as a backup appliance with XenCenter we can avoid the disadvantages (always on etc.) 2. Bash Script A very good script with many space for improvements. But scripts running in the Dom0 Linux are in my opinion not a good idea. 06/06/10 © 2010 Thomas Krampe 18
  • 38. My Results All of these three example scripts do their job as expected. 1. VB Script In my opinion the best way to create backups. If we install a virtual Windows machine as a backup appliance with XenCenter we can avoid the disadvantages (always on etc.) 2. Bash Script A very good script with many space for improvements. But scripts running in the Dom0 Linux are in my opinion not a good idea. 3. Python Script Good script but currently no support for Windows VM‘s 06/06/10 © 2010 Thomas Krampe 18
  • 39. Restore 06/06/10 © 2010 Thomas Krampe 19
  • 40. Restore Backup is only the first part of the job. Some times it‘s maybe very usefull to have also the capabilities to restore a backup if the original virtual machine is broken. 06/06/10 © 2010 Thomas Krampe 19
  • 41. Restore Backup is only the first part of the job. Some times it‘s maybe very usefull to have also the capabilities to restore a backup if the original virtual machine is broken. All backup scripts as well as the manual way with XenCenter or CLI creates a simple .xva file which can easy re-import. 06/06/10 © 2010 Thomas Krampe 19
  • 42. Restore Backup is only the first part of the job. Some times it‘s maybe very usefull to have also the capabilities to restore a backup if the original virtual machine is broken. All backup scripts as well as the manual way with XenCenter or CLI creates a simple .xva file which can easy re-import. In most cases this re-import is being enough. But for a correct restore you need also a backup of the virtual machine meta data (MAC-Address or VCPU Settings for example). 06/06/10 © 2010 Thomas Krampe 19
  • 43. Restore Example 06/06/10 © 2010 Thomas Krampe 20
  • 44. Restore Example Before perfoming a restore it‘s a good idea to uninstall the broken machine first. xe vm-uninstall uuid=<VM UUID> force=true Then cleanup the Storage repository. coalesce-leaf -u <VM UUID> And restore the virtual machine. xe vm-import filename=<BACKUP.XVA> preserve=true If preserve is set to true, the MAC address of the original VM will be preserved. 06/06/10 © 2010 Thomas Krampe 20
  • 45. Enhancements Here are some tips for enhancements. 06/06/10 © 2010 Thomas Krampe 21
  • 46. Enhancements Here are some tips for enhancements. 1. Backup VM meta data 2. Check backup share first (free space, availability) 3. Cleanup backup share (old backups) 4. Create useful log files 5. Notfications (E-Mail, SMS) . . . x. Your ideas for improvements 06/06/10 © 2010 Thomas Krampe 21
  • 47. What‘s new in 5.6 Live Memory Snapshot and Rollback - XenCenter support for live VM snapshot and revert - One-click Revert - Snapshot branches 06/06/10 © 2010 Thomas Krampe 22
  • 48. What‘s new in 5.6 New snapshot with memory feature In addition to saving the VMs memory (storage) and metadata, snapshots with memory also save the VMs state (RAM). xe vm-checkpoint vm=<VM UUID> new-name-label=<NAME> 06/06/10 © 2010 Thomas Krampe 23
  • 49. What‘s new in 5.6 New snapshot with memory feature In addition to saving the VMs memory (storage) and metadata, snapshots with memory also save the VMs state (RAM). xe vm-checkpoint vm=<VM UUID> new-name-label=<NAME> During the checkpoint creation process, the VM is paused for a brief period of time, and cannot be used during this period. 06/06/10 © 2010 Thomas Krampe 23
  • 50. Commercial Products 06/06/10 © 2010 Thomas Krampe
  • 51. Commercial Products If you don‘t have time or fun for scripting and in addition have unlimited budget, here are some commercial products. QuorumSoft Alike http://quorumsoft.com PHD Virtual Backup for Citrix XenServer http://www.phdvirtual.com Symantec Backup Exec System Recovery Server Edition http://www.symantec.com/de/de/business/backup- exec-system-recovery-server-edition 06/06/10 © 2010 Thomas Krampe 24
  • 52. Contact Informations For questions / suggestions after the Pubforum: thomas.krampe@visionapp.de More informations online: www.thomas-krampe.com in german only Slides are available after the Pubforum at: 06/06/10 © 2010 Thomas Krampe 25
  • 53. Questions 06/06/10 © 2010 Thomas Krampe 26
  • 54. Questions 06/06/10 © 2010 Thomas Krampe 26
  • 55. Questions Cheers 06/06/10 © 2010 Thomas Krampe 26