Enable Citrix VM Backup and Disaster Recovery with xe CLI

This article explains what is xe CLI and lists part of its commands for reference.

download-icon
Free Download
for VM, OS, DB, File, NAS, etc.
dan-zeng

Updated by Dan Zeng on 2024/01/24

Table of contents
  • What is xe CLI?

  • Citrix Hypervisor (XenServer) Backup

  • Citrix Hypervisor (XenServer) Disaster Recovery

  • Citrix Hypervisor (XenServer) Backup and Recovery with Citrix Partner

  • Conclusion

It is vital virtualization backup and recovery are given priority as everyone knows. The essence is to protect business-critical data from loss, corruption, or damage after the disruption. Citrix presents multiple ways to perform these tasks, and one of them is xe CLI. You must be wondering, what is xe CLI? How it backs up and restores VMs with scripts? And besides this way, is there any alternative to simplify the process? Let’s go ahead and read for the answers.

What is xe CLI?

Xe CLI is a command line interface for Citrix Hypervisor (XenServer) users. It allows for scripting and management jobs automation. The tool comes pre-installed by default on all Citrix Hypervisor servers and is part of XenCenter. Linux users can also access a standalone remote CLI.

There are two parts to xe CLI commands. The listing and parameter tinkering of API objects are the main concerns of low-level commands, typically starting with class- like class-param-get, class-param-add, class-param-clear, or class-param-list. Low-level commands use UUID to locate the particular object, for example, xe class-param-list uuid=uuid. While interfacing with hosts or VMs on a more abstract level, higher-level commands are utilized.

You can use various parameters to identify the objects and specify their states, avoid passwords being stored in command line history or on API objects, or back up and recover server data with it. Read the 10 best practices for a better understanding of XenServer backup and how to easily back it up in different ways.

xe CLI Commands:

Appliance commands:

They create and modify VM appliances, and include parameters of uuid, name-description, paused, and force.

Create an appliance: 

xe appliance-create name-label=xx_appliance

Destroy a vAPP:

xe appliance-destroy uuid=vApp-uuid

Recover a VM appliance:

xe appliance-recover uuid=appliance-uuid database:vdi-uuid=vdi-uuid [paused=true|false]

Bonding commands:

They work with network bonds and perform the failover of the physical interface, which contain uuid, master, and members parameters.

Create a bonded network interface on the network you've defined. Any of the following situations result in a command failure:

  • PIFs that are currently a part of another bond;

  • Whenever a VLAN tag is set on any member;

  • If fewer than two PIFs are provided;

  • If the referenced PIFs are not located on the same Citrix Hypervisor server.

xe bond-create network-uuid=network_uuid pif-uuids=pif_uuid_A,pif_uuid_B,...

CD commands:

Interact with physical CD/DVD drives on Citrix Hypervisor systems and have multiple parameters such as uuid, name-label, name-description, vbd-uuids, type, sharable, read-only, parent, and more.

List the CDs and ISOs on the server with params filters.

xe cd-list [params=paramA,paramB,...] [parameter=parameter_value]

Or use all to show all parameters.

Diagnostic commands:

Obtain diagnostic data from the hypervisor.

Print database data:

xe diagnostic-gc-stats

Check the status of a VDI's locking and sharing:

xe diagnostic-vm-status uuid=vm_uuid

Apart from those mentioned above, xe CLI provides a bunch of other commands for Citrix customers to execute, for more detailed information, view the website.

The capabilities of xe commands are way more than that. You can even manipulate host parameters and recovery commands to complete the VM data protection.

Citrix Hypervisor (XenServer) Backup

Backup server from a remote-off host with enough storage space:

xe host-backup file-name=filename -h hostname -u root -pw password

Backup a VM with all data included (in offline status):

xe vm-export vm=vm_uuid filename=backup

Backup only the metadata of the VM:

xe vm-export vm=vm_uuid filename=backup metadata=true

Backup the pool metadata:

xe pool-dump-database file-name=backup

Backup configuration files and software on the host:

xe host-backup host=host file-name=hostbackup

Citrix Hypervisor (XenServer) Disaster Recovery

Replicate database in the production site:

xe sr-database-replication uuid=sr=uuid

Connect to the SR:

xe drtask-create type=type device-config=device-config sr-whitelist=sr-uuid

Search for VDIs of the database:

xe vdi-list sr-uuid=sr-uuid type=Metadata

Inquire the VM presence:

xe vm-list database:vdi-uuid=vdi-uuid

Recover the VM:

xe vm-recover uuid=vm-uuid database:vdi-uuid=vdi-uuid

Restore the pool metadata:

xe pool-restore-database file-name=backup dry-run=true

Restore the VM metadata:

xe pool-restore-database file-name=/var/backup/pool-database-* -h hostname -u root -pw password

Restore a running server:

xe host-restore file-name=filename -h hostname -u root -pw password

Destroy a DR task and forget the SR:

xe drtask-destroy uuid=dr-task-uuid

Citrix Hypervisor (XenServer) Backup and Recovery with Citrix Partner

Xe CLI tool provides a variety of commands to enable VM backup and recovery, however, it may not be so convenient and user-friendly when using for the lack of GUI. And they do not offer many backup options like a full and incremental backup that are commonly used in backup plans.

Vinchin Backup & Recovery is recognized as a Citrix partner backup tool and delivers VM backup and recovery services for 12 virtualizations including Citrix Hypervisor (XenServer), XCP-ng, VMware, Hyper-V, etc. The smart backup solution has the following benefits:

Automatic backup: enable backup automation under schedule from full, incremental, CBT-supported forever incremental, and differential backup options.

Reduce storage consumption: eliminate at least 50% of data size in the wake of deduplication and compression, while developing the exclusive deep data extraction technology BitDetector for large-scale IT environments.

Faster speed: the agentless software accelerates backup greatly with SAN transmission, multithread, CBT/SpeedKit technology, pre-create snapshot, and other techniques.

Safer backup: secure backups in the Vinchin backup server with AES-256 encryption standard and send an offsite backup copy for emergencies.

Shorter RTO and RPO: select from full, file-level, and 15s instant recovery for different scenarios to bring data loss down.

Additionally, Vinchin Backup & Recovery allows for cross-platform V2V migration across 10+ platforms, backup and recovery for databases, NAS, Physical Servers, and data archiving for retention. 

Download the 60-day trial of the Enterprise Edition to explore all features:

Citrix Hypervisor (XenServer) Backup

1.     Choose source VM(s) to be backed up from the licensed server list.

2.     Select a node and storage to run the job.

3.     Customize the backup tactics.

4.     View and submit.

03f3f7e8d547999d58ea961680dca05.png

Citrix Hypervisor (XenServer) Recovery

1.     Choose the source backups.

2.     Select the host from the same or different platforms.

3.     Specify recovery strategies.

4.     View and submit.

b186be3c0d5570be7caa31a8e7e2daf.png

Conclusion

This article explains what is xe CLI and lists part of its commands for reference. Those scripts can be used to create virtual appliances, define network parameters, work with CD/DVD, and back up and restore VM data.

If you find those codes tricky and are searching for an easier alternative way, you can resort to Vinchin Backup & Recovery, a trustable backup tool certified by Citrix, with cost-effective prices and quality services.

Share on:

Categories: VM Backup
Free Trial Now close-icon