• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Backup VMs Metadata in Citrix Xenserver

Written by Rahul, Updated on November 22, 2018
Citrix XenServer backup, citrix, metadata, xenserver

This article describes how to back up metadata for an individual Virtual Machines on Citrix Xen Servers. In this article, you will get step by step instructions for backing up metadata. Also at end of this article, there is a small shell script which can be used for backup metadata for all VMs running on the Xen server.

citrix-image

1. Backup VMs Metadata in Citrix Xenserver

1.1. Find VMs UUID

Use the following command to get list of UUIDs of all vms along with other details. this UUID will be used in next steps.

xe vm-list is-control-domain=false is-a-snapshot=false
uuid ( RO)           : 8ac95696-94f3-83c1-bc89-8bb2603f832b
     name-label ( RW): test-vm
    power-state ( RO): running

As per above output test-vm uuid is “8ac95696-94f3-83c1-bc89-8bb2603f832b“.

1.2. Backup Metadata using UUID

After getting UUID of vm, use following command to backup metadata of virtual machine with uuid 8ac95696-94f3-83c1-bc89-8bb2603f832b and create metadata backup file metadata.bak.

xe vm-export filename=metadata.bak uuid=8ac95696-94f3-83c1-bc89-8bb2603f832b metadata=true

You have completed vm metadata backup successfully.

2. Script for Backup All VMs Metadata

This is a good option to schedule metadata backup regularly. You can schedule the below script for backup all the vms metadata on Xen server.

How to use script:

2.1 – Copy this script to a file /scripts/metadata-backup.sh in xenserver.

2.2 – This script is using a remote backup server mounted using nfs, You can replace this with your own settings.

2.3 – Execute this script using sh /scripts/metadata-backup.sh.

2.4 – For regular backup schedule this in systems crontab. [Crontab Examples]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
 
DATE=$(date +%d%B%y)
XSNAME=`echo $HOSTNAME`
mkdir -p /mnt/nfs
 
mount -F nfs 192.168.10.100:/backup/citrix/metadata /mnt/nfs
 
BACKUPPATH=/mnt/nfs/$XSNAME/$DATE
mkdir -p $BACKUPPATH
 
xe vm-list is-control-domain=false is-a-snapshot=false | grep uuid | cut -d":" -f2 >  /tmp/uuids.txt
 
while read line
do
    VMNAME=`xe vm-list uuid=$line | grep name-label | cut -d":" -f2 | sed 's/^ *//g'`
    xe vm-export filename="$BACKUPPATH/$XSNAME-$VMNAME-$DATE" uuid=$line metadata=true
done < /tmp/uuids.txt
umount /mnt/nfs

Share it!
Share on Facebook
Share on Twitter
Share on Google+
Share on Reddit
Share on Tumblr
Rahul
Rahul
Connect on Facebook Connect on Twitter Connect on Google+

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Related Posts

  • An Advance Bash Script for MySQL Database Backup

    July 30, 2017
  • How To Create Ubuntu 16.04 LTS VM in XenServer 6.2

    August 9, 2016
  • How To Add Ubuntu 16.04 LTS Template in XenServer 6.2

    August 5, 2016
  • How to Backup Running Virtual Machine in XenServer

    August 1, 2016
  • How To Add CentOS 7 Template in XenServer 6.2

    May 11, 2016

Leave a Reply

Cancel reply

Popular Posts

  • How To Install Zabbix Agent on Debian 9/8
  • How to Install and Configure Squid Proxy on Debian 9
  • How To Install Wine 3 on Debian 9 (Stretch)
  • How to Remove “public/index.php” from URL in Laravel
  • How to Install Swift on Ubuntu 18.04 LTS
All rights reserved. © 2013-2018 TecAdmin.net. This site uses cookies. By using this website you agree our term and services