dotlinux blog

xe – Full Command List Reference with Description for XenServer

XenServer, a powerful enterprise-grade virtualization platform developed by Citrix (now part of Cloud Software Group), enables organizations to virtualize servers, desktops, and applications with high performance and scalability. At the heart of XenServer management is the xe command-line tool—a lightweight, scriptable utility that allows administrators to control nearly every aspect of XenServer hosts, virtual machines (VMs), storage, networking, and more.

While XenCenter (XenServer’s graphical user interface) simplifies day-to-day management, the xe command-line tool is indispensable for automation, scripting, remote administration, and troubleshooting. This guide serves as a comprehensive reference for xe commands, organized by use case, with detailed syntax, descriptions, and practical examples to help you master XenServer administration.

2026-01

Table of Contents#

  1. Basic xe Commands
  2. Host Management Commands
  3. Virtual Machine (VM) Management Commands
  4. Storage Management Commands
  5. Networking Commands
  6. Template Management Commands
  7. Snapshot Management Commands
  8. Advanced Commands
  9. Conclusion
  10. References

Basic xe Commands#

These commands help you get started with xe, including accessing help, checking version information, and understanding command structure.

1. xe help#

Syntax: xe help [command]
Description: Displays help information for xe or a specific subcommand.
Example:

# Get general help for xe  
xe help  
 
# Get detailed help for the vm-list command  
xe help vm-list  

2. xe version#

Syntax: xe version
Description: Shows the version of XenServer and the xe tool installed on the host.
Example:

xe version  
# Output: XenServer 8.2.0 (build 12345)  

3. xe info#

Syntax: xe info
Description: Prints system-wide information about the XenServer host, including CPU, memory, and hypervisor details.
Example:

xe info  
# Output includes: Hostname, CPU model, Total memory, Xen version, etc.  

Host Management Commands#

Hosts are physical servers running XenServer. These commands manage host status, configuration, and maintenance.

1. xe host-list#

Syntax: xe host-list [params]
Description: Lists all XenServer hosts in the pool (or standalone host). Use params to filter results (e.g., name-label).
Parameters:

  • name-label=<string>: Filter by host name (e.g., name-label=server01).
  • uuid=<uuid>: Filter by host UUID.
    Example:
# List all hosts with their name and UUID  
xe host-list params=name-label,uuid  
 
# Filter hosts by name  
xe host-list name-label=prod-host-01  

2. xe host-param-get#

Syntax: xe host-param-get uuid=<host-uuid> param-name=<parameter>
Description: Retrieves a specific parameter value for a host (e.g., IP address, power state).
Parameters:

  • uuid: UUID of the host (required).
  • param-name: Name of the parameter to fetch (e.g., address, power-state).
    Example:
# Get the IP address of a host  
xe host-param-get uuid=abc123 param-name=address  

3. xe host-reboot#

Syntax: xe host-reboot uuid=<host-uuid> [force=<true|false>]
Description: Reboots a XenServer host. Use force=true to reboot even if VMs are running (destructive).
Parameters:

  • uuid: Host UUID (required).
  • force: Set to true to reboot without shutting down VMs first (default: false).
    Example:
# Safely reboot a host (shuts down VMs first)  
xe host-reboot uuid=abc123  
 
# Force reboot (use with caution!)  
xe host-reboot uuid=abc123 force=true  

4. xe host-evacuate#

Syntax: xe host-evacuate uuid=<host-uuid> target-host-uuid=<target-uuid>
Description: Migrates all VMs from a source host to a target host (for maintenance).
Parameters:

  • uuid: Source host UUID (required).
  • target-host-uuid: Target host UUID (required).
    Example:
# Evacuate VMs from host1 to host2  
xe host-evacuate uuid=host1-uuid target-host-uuid=host2-uuid  

Virtual Machine (VM) Management Commands#

VMs are virtualized workloads running on XenServer hosts. These commands create, start, stop, and configure VMs.

1. xe vm-list#

Syntax: xe vm-list [params] [filters]
Description: Lists all VMs on the host/pool. Use params to specify output fields and filters to narrow results.
Parameters:

  • params=<comma-separated-fields>: Fields to display (e.g., name-label,power-state,uuid).
  • power-state=<state>: Filter by VM power state (running, halted, suspended).
  • name-label=<string>: Filter by VM name.
    Example:
# List running VMs with name and UUID  
xe vm-list power-state=running params=name-label,uuid  
 
# Find a VM by name  
xe vm-list name-label="Web Server"  

2. xe vm-create#

Syntax: xe vm-create name-label=<vm-name> template=<template-uuid> sr-uuid=<sr-uuid> [other-params]
Description: Creates a new VM from a template or scratch.
Parameters:

  • name-label: Name of the VM (required).
  • template: UUID of the VM template (e.g., CentOS 7 template; use xe template-list to find).
  • sr-uuid: UUID of the Storage Repository (SR) to store the VM’s disks (required).
  • memory-static-max: Max memory (e.g., 4GiB).
  • vcpus-max: Max vCPUs (e.g., 2).
    Example:
# Create a VM from a CentOS template with 4GB RAM and 2 vCPUs  
xe vm-create name-label="My CentOS VM" \  
  template=centos7-template-uuid \  
  sr-uuid=my-sr-uuid \  
  memory-static-max=4GiB \  
  vcpus-max=2  

3. xe vm-start#

Syntax: xe vm-start uuid=<vm-uuid> [force=<true|false>]
Description: Starts a VM. Use force=true to bypass checks (e.g., if the host is in maintenance mode).
Parameters:

  • uuid: VM UUID (required).
  • force: Override safety checks (default: false).
    Example:
# Start a VM  
xe vm-start uuid=my-vm-uuid  

4. xe vm-shutdown#

Syntax: xe vm-shutdown uuid=<vm-uuid> [force=<true|false>]
Description: Gracefully shuts down a VM (sends ACPI shutdown signal). Use force=true to power off immediately (like pulling the plug).
Parameters:

  • uuid: VM UUID (required).
  • force: Power off instead of graceful shutdown (default: false).
    Example:
# Gracefully shut down a VM  
xe vm-shutdown uuid=my-vm-uuid  
 
# Force power off (use only if VM is unresponsive)  
xe vm-shutdown uuid=my-vm-uuid force=true  

5. xe vm-param-set#

Syntax: xe vm-param-set uuid=<vm-uuid> param-name=<param> param-value=<value>
Description: Modifies a VM’s configuration (e.g., name, memory, vCPUs).
Common Parameters:

  • name-label: Rename the VM.
  • memory-static-max: Update max memory (e.g., 8GiB).
  • vcpus-max: Update max vCPUs (e.g., 4).
    Example:
# Rename a VM  
xe vm-param-set uuid=my-vm-uuid name-label="Updated Web Server"  
 
# Increase VM memory to 8GB  
xe vm-param-set uuid=my-vm-uuid memory-static-max=8GiB  

6. xe vm-destroy#

Syntax: xe vm-destroy uuid=<vm-uuid>
Description: Permanently deletes a VM (including its disks, unless disks are detached first).
Warning: Irreversible! Ensure the VM is halted first.
Example:

# Destroy a VM  
xe vm-destroy uuid=my-vm-uuid  

Storage Management Commands#

Storage Repositories (SRs) and Virtual Disk Images (VDIs) are managed with these commands.

1. xe sr-list#

Syntax: xe sr-list [params]
Description: Lists all SRs (storage pools) on the host/pool. SRs can be local (LVM, ext4) or shared (NFS, iSCSI).
Parameters:

  • name-label=<string>: Filter by SR name (e.g., name-label="Local SSD").
  • type=<type>: Filter by SR type (e.g., nfs, lvm).
    Example:
# List all SRs with name and type  
xe sr-list params=name-label,type,uuid  

2. xe sr-create#

Syntax: xe sr-create name-label=<sr-name> type=<sr-type> device-config=<config> host-uuid=<host-uuid>
Description: Creates a new SR.
Parameters:

  • type: SR type (nfs, iscsi, ext, etc.).
  • device-config: Type-specific configuration (e.g., server=192.168.1.100,share=/exports/xen for NFS).
  • host-uuid: Host to attach the SR to (required for shared SRs).
    Example:
# Create an NFS SR  
xe sr-create name-label="NFS Storage" \  
  type=nfs \  
  device-config:server=10.0.0.50 \  
  device-config:share=/mnt/nfs/xenserver \  
  host-uuid=my-host-uuid  

3. xe vdi-list#

Syntax: xe vdi-list [params]
Description: Lists all VDIs (virtual disks) in SRs. VDIs are attached to VMs as disks.
Parameters:

  • name-label=<string>: Filter by VDI name.
  • sr-uuid=<sr-uuid>: Filter by SR UUID.
    Example:
# List VDIs in a specific SR  
xe vdi-list sr-uuid=my-sr-uuid params=name-label,size,uuid  

4. xe vdi-create#

Syntax: xe vdi-create name-label=<vdi-name> sr-uuid=<sr-uuid> size=<size>
Description: Creates a new VDI (virtual disk) in an SR.
Parameters:

  • size: Disk size (e.g., 50GiB, 10000MiB).
  • sr-uuid: SR to store the VDI (required).
    Example:
# Create a 50GB VDI in "Local SSD" SR  
xe vdi-create name-label="Data Disk" sr-uuid=my-sr-uuid size=50GiB  

5. xe vbd-create#

Syntax: xe vbd-create vm-uuid=<vm-uuid> vdi-uuid=<vdi-uuid> device=<device>
Description: Attaches a VDI to a VM as a Virtual Block Device (VBD).
Parameters:

  • device: Disk device name (e.g., xvda, xvdb; Xen uses xvd prefix).
    Example:
# Attach "Data Disk" VDI to VM as xvdb  
xe vbd-create vm-uuid=my-vm-uuid vdi-uuid=data-disk-uuid device=xvdb  

Networking Commands#

XenServer networking involves virtual networks, VIFs (VM network interfaces), and physical NIC bonding.

1. xe network-list#

Syntax: xe network-list [params]
Description: Lists all virtual networks on the host/pool. Virtual networks bridge VMs to physical NICs.
Parameters:

  • name-label=<string>: Filter by network name (e.g., name-label="Management Network").
    Example:
# List all virtual networks  
xe network-list params=name-label,uuid,bridge  

2. xe vif-list#

Syntax: xe vif-list [params]
Description: Lists Virtual Interface (VIF) objects, which connect VMs to virtual networks.
Parameters:

  • vm-uuid=<vm-uuid>: Filter VIFs by VM.
  • network-uuid=<network-uuid>: Filter VIFs by network.
    Example:
# List VIFs for a specific VM  
xe vif-list vm-uuid=my-vm-uuid params=vm-name-label,network-name-label,device  

3. xe bond-create#

Syntax: xe bond-create network-uuid=<network-uuid> pif-uuids=<pif1-uuid>,<pif2-uuid>
Description: Creates a bonded (teamed) network interface from physical NICs (PIFs) for redundancy or throughput.
Parameters:

  • network-uuid: Virtual network to attach the bond to.
  • pif-uuids: Comma-separated list of physical NIC (PIF) UUIDs (use xe pif-list to find PIFs).
    Example:
# Bond eth0 and eth1 into a redundant network  
xe bond-create network-uuid=my-network-uuid pif-uuids=pif1-uuid,pif2-uuid  

Template Management Commands#

Templates are pre-configured VM images used to quickly create new VMs.

1. xe template-list#

Syntax: xe template-list [params]
Description: Lists all VM templates (e.g., CentOS 7, Windows Server 2019).
Example:

# List all templates with name and UUID  
xe template-list params=name-label,uuid  

2. xe template-param-set#

Syntax: xe template-param-set uuid=<template-uuid> param-name=<param> param-value=<value>
Description: Modifies a template’s default configuration (e.g., memory, vCPUs).
Example:

# Update template to default to 4GB memory  
xe template-param-set uuid=centos7-template-uuid memory-static-max=4GiB  

Snapshot Management Commands#

Snapshots capture point-in-time copies of VMs for backup or testing.

1. xe vm-snapshot#

Syntax: xe vm-snapshot vm-uuid=<vm-uuid> new-name-label=<snapshot-name>
Description: Creates a snapshot of a VM. Snapshots are read-only by default.
Example:

# Snapshot a running VM  
xe vm-snapshot vm-uuid=my-vm-uuid new-name-label="Pre-Upgrade Snapshot"  

2. xe snapshot-revert#

Syntax: xe snapshot-revert snapshot-uuid=<snapshot-uuid>
Description: Reverts a VM to the state captured in a snapshot. The VM must be halted first.
Example:

# Halt VM, then revert to snapshot  
xe vm-shutdown uuid=my-vm-uuid  
xe snapshot-revert snapshot-uuid=my-snapshot-uuid  
xe vm-start uuid=my-vm-uuid  

3. xe snapshot-destroy#

Syntax: xe snapshot-destroy uuid=<snapshot-uuid>
Description: Deletes a snapshot.
Example:

# Delete an old snapshot  
xe snapshot-destroy uuid=my-snapshot-uuid  

Advanced Commands#

These commands handle pools, tasks, and events for enterprise environments.

1. xe pool-list#

Syntax: xe pool-list
Description: Lists XenServer pools (groups of hosts sharing storage and networking).
Example:

xe pool-list params=name-label,master,uuid  

2. xe task-list#

Syntax: xe task-list [params]
Description: Lists ongoing tasks (e.g., VM migration, SR creation) with status (pending, success, failure).
Example:

# List active tasks  
xe task-list params=name-label,status,uuid  

3. xe event-wait#

Syntax: xe event-wait class=<class> [params]
Description: Blocks until a specific event occurs (useful for scripting).
Parameters:

  • class: Event class (e.g., vm, task, host).
  • state=<state>: Wait for a specific state (e.g., power-state=running for VMs).
    Example:
# Wait until VM "Web Server" starts  
xe event-wait class=vm name-label="Web Server" power-state=running  

Conclusion#

The xe command-line tool is a cornerstone of XenServer administration, offering granular control over hosts, VMs, storage, networking, and more. Whether you’re scripting automation, troubleshooting, or managing large-scale deployments, mastering xe commands streamlines workflows and unlocks XenServer’s full potential.

For the latest updates or vendor-specific commands, always refer to the official XenServer documentation.

References#