Xm Command - Xen Management Tool Guide | Online Free DevTools by Hexmos

Explore the Xm command for Xen management. Learn to list domains, manage VMs, view logs, and control Xen hosts with this essential command-line tool.

Xm Command Reference

The xm command is a powerful command-line utility for managing Xen virtual machines and hosts. It provides a comprehensive set of tools for monitoring, controlling, and configuring your Xen environment directly from the terminal.

Xen Management Commands

Below is a detailed reference of common xm commands and their functionalities:

# xm
# Xen management user interface.

# Shows information about the Xen host
xm info

# Shows information about doms (states include r for running, b for blocked, c
# for crashed, p for paused and the worse, d for dying).
xm list

# Shows virtual interfaces for doms
xm network-list

# Shows information from the Xen logs
xm log

# Reboots a VM
xm reboot

# Shows dom virtual processors
xm vcpu-list

# Shows hosts and domains similar to how top works in *nix
xm top

# Shows uptime
xm uptime

# Shows the send message buffer
xm dmesg

# Create a node called ${domain_name}
xm create ${domain_name}

# Attach to the console of the ${domain_name} node
xm console ${domain_name}

# Deletes that newly created ${domain_name} node
xm destroy ${domain_name}

# Invoke an interactive shell environment of your xend
xm shell

# Turn off a VM
xm shutdown

# Rather than shut the VM down, just pause it (starts back up much faster),
# but if the host is rebooted then state is lost (otherwise use suspend)
xm pause

# Suspends VM, which writes data to disk, so changes won't be lost on restart.
xm suspend

# Rename installed VMs
xm rename

# If a VM is paused, fire it up
xm resume

# Similar to suspend except with user definable state file
xm save

# Similar to resume except can be restored with exports that used the save verb
xm restore

# Dumps core per domain
xm dump-core

# Sends system requests per domain
xm sysrq

# Lists block devices per domain
xm block-list

# Configure the maximum memory for a domain
xm mem-max

# Configure the current memory allowance for a domain
xm mem-set

# Configure active processors for a domain
xm vcpu-set

# Move a domain to another server (e.g. using the -l operator to do so live)
xm migrate

Understanding Xen VM States

The xm list command provides crucial information about the state of your virtual machines (domains). Understanding these states is vital for effective management:

  • r: Running - The virtual machine is currently active and executing.
  • b: Blocked - The virtual machine is waiting for an event, such as I/O.
  • c: Crashed - The virtual machine has encountered a critical error and terminated unexpectedly.
  • p: Paused - The virtual machine's execution has been temporarily suspended.
  • d: Dying - The virtual machine is in the process of shutting down.

Advanced Xen Management

For more advanced operations, xm allows fine-grained control over VM resources and migration. Commands like xm migrate enable live migration of VMs between hosts, minimizing downtime. You can also precisely configure memory (xm mem-max, xm mem-set) and virtual CPUs (xm vcpu-set) to optimize performance.

Further Resources