Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Citrix XenServer»How to Backup VMs Metadata in Citrix Xenserver

    How to Backup VMs Metadata in Citrix Xenserver

    By RahulJune 4, 20142 Mins ReadUpdated:November 22, 2018

    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.

    Advertisement

    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

    backup citrix metadata xenserver
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Backing Up Your Linux System with Rsync: A Step-by-Step Guide

    Shell Script to Backup MySQL Databases to Amazon S3

    Backup MySQL Databases to Amazon S3 (Shell Script)

    How to Backup Website to Amazon S3 using Shell Script

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Error: EACCES: permission denied, scandir (Resolved)
    • How To Install Python 3.11 on Ubuntu 22.04 / 20.04
    • How to Install Python 3.11 on Amazon Linux 2
    • An Introduction to the “./configure” Command: Compiling Source Code in Linux
    • How to Install PHP 8.x on Pop!_OS
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.