Jump to content
Welcome to our new Citrix community!
  • 0

Problem with Backup using command line?


Reginald Goldman

Question

Hello

 

I am running Hypervisor/XenServer 8.0. I have a script that backs up VMs to an sshfs directory. It's been running fine for years but today I could not access the Host or any Guests by IP, I suspect it was the backup process or something related because it occurred around the same time. Could not access any services, so I used IPMI to access the server fine. I tried to restart xapi just for giggles but didn't help. I used IPMI to reboot the server and after that everything was fine. The Host and VMs all seemed to be running fine just no network connectivity. Also, I notice high cpu usage by qemu* on the Host for extended periods of time after the script has run, like for a day, maybe two. I'm wandering if anyone has any insight to what caused the issue or any logs I can look at etc? I'm still not sure the backup caused my no connectivity problem but it sure did seem like it. Thoughts? Thanks guys for any info or recommendations! Also what do you use for VM backup?

 

Here is my backup script (runs once a week):

DATE=`date +%d%b%Y`
DATETIME=`date +%d%b%Y%H%M%S`
UUIDFILE=/tmp/xen-uuids.txt
BACKUPPATH=/mnt/export/${DATE}

umount /mnt/export
mount /mnt/export

mkdir -p ${BACKUPPATH}

if [ ! -d ${BACKUPPATH} ]
then
        echo "No backup directory found"; 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 list file found"; 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-$VMUUID-$DATETIME"`

    xe template-param-set is-a-template=false ha-always-run=false uuid=${SNAPUUID}

    xe vm-export vm=${SNAPUUID} filename="$BACKUPPATH/$VMNAME-$DATETIME.xva"

    xe vm-uninstall uuid=${SNAPUUID} force=true

done < ${UUIDFILE}

umount /mnt/export

 

Link to comment

2 answers to this question

Recommended Posts

  • 0

It would be useful to print out debug steps as the script executes as it's otherwise going to be tough to guess where things are blowing up. The same NAU VMbackup script that we've been running for years still works with XS 8.0, though a few tweaks were needed.  To see the history, go to https://github.com/NAUbackup/VmBackup/

That said, these were API issues, hence may be irrelevant to your specific case since I see you use plain xe commands.

 

Also, if you have VM name-labels containing white space or special characters, you will likely have to enclose the variable name in quotes and possible escape special characters.

 

-=Tobias

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...