User Tools

Site Tools


virtualization:xenserver:xenserver_backup_cli

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

virtualization:xenserver:xenserver_backup_cli [2013/04/12 11:12]
127.0.0.1 external edit
virtualization:xenserver:xenserver_backup_cli [2023/05/15 12:28] (current)
gcooper
Line 2: Line 2:
  
 FIXME Needs testing and updating FIXME Needs testing and updating
 +
 +===== Manual Mode =====
  
 With XenServer it is possible to create backups of VMs, even if they are running. The process is as follows: With XenServer it is possible to create backups of VMs, even if they are running. The process is as follows:
Line 40: Line 42:
 <file> <file>
 xe vm-uninstall uuid=<uuid of snapshot> force=true xe vm-uninstall uuid=<uuid of snapshot> force=true
 +</file>
 +
 +===== Scripted Mode =====
 +
 +<file>
 +#!/bin/bash
 +
 +datum=`date +%Y%b%d`
 +xsname=`hostname`
 +uuidfile=/root/xenuuids.txt
 +mountpoint=/var/removable
 +backuppath=$mountpoint/vms/$xsname/$datum
 +
 +if [ ! -d $mountpoint/vms ]; then
 + mount /dev/sdb1 $mountpoint
 + mkdir $mountpoint/vms
 +fi
 +
 +if [ ! -d $mountpoint/vms ]; then
 + echo "No mountpoint found. Please check!"
 + exit 0
 +fi
 +
 +mkdir -p $backuppath
 +if [ ! -d $backuppath ]; then
 + echo "No backup path found. Please check!"
 + exit 0
 +fi
 +
 +xe vm-list is-control-domain=false is-a-snapshot=false | grep uuid | cut -d":" -f2 > $uuidfile
 +
 +if [ ! -f $uuidfile ]; then
 + echo "No UUID file found. Please check!"
 + exit 0
 +fi
 +
 +while read VMUUID
 + do
 +  VMNAME=`xe vm-list uuid=$VMUUID | grep name-label | cut -d":" -f2 | sed 's/^ *//g'`
 +  SNAPUUID=`xe vm-snapshot uuid=$VMUUID new-name-label="SNAPSHOT-$VMNAME-$datum"
 +
 +  xe template-param-set is-a-template=false ha-always-run=false uuid=$SNAPUUID
 +  xe vm-export vm=$SNAPUUID filename=$backuppath/SNAPSHOT-$VMNAME-$datum.xva
 +  xe vm-uninstall uuid=$SNAPUUID force=true
 +
 +done <$uuidfile
 +
 +umount $mountpoint
 +
 +exit
 </file> </file>
virtualization/xenserver/xenserver_backup_cli.1365786727.txt.gz · Last modified: 2013/04/12 11:12 by 127.0.0.1