Useful Commands for Virtual Machine Management on Xen


The following commands are commonly used for system administrators to manage virtual machines on Xen.

1. To start a Xen if it is not running
# /etc/init.d/xend start

2. To check what VMs are runing in a physical machine
# xm list

3. To start a VM
# xm create [-c] 'run-config-file'

4. To start a VM in single mode, add one line into run-config-file
# extra='single'

5. To shutdown a VM
# xm shutdown 'vm-name'

6. To terminate a VM in brute force
# xm destroy 'vm-name'

7. To switch among VMs' terminals
a) Go to a Domain-U
# xm console 'vm-name'
b) Return to the Domain-0
# Ctrl + ]

8. To check which VCPUs are dedicated to some VM domain
# xm vcpu-list

9. To set specific VCPUs dedicated to some VM domain
# xm vcpu-set 'domain' "#-of-vcpu'
# xm vcpu-pin 'domain' 'vpcu-id'

10. To set the weight and cap (in %) of CPU cycles some VM domain may receive
# xm sched-credit -d 'domain' -w 'weight' -c 'cap'

11. To change the memory allocation for some running VM
# xm mem-set 'RAM-MiB'

12. To set the maximum memory that some VM domain is allowed to use
# xm mem-max 'RAM-MiB'