Então aqui está o código que eu criei. Isso acontece todos os dias às 4 da manhã através do cron do SUDO
#!/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
Aproveite! :)