1. xm command
You can run the xm command to start and stop a VM. The command is as follows:
Xm create vm1 # Where vm1 is the virtual machine configuration file, located in/etc/xen/vm/vm1
Xm create-c vm1 # If you need to start the console, you can run the command
Xm list # list all virtual machines
Xm console <domid> # displays the console of a Virtual Machine
Xm reboot <domid> # You can restart a virtual machine with the id of domid.
Xm shutdown <domid> # shut down a virtual machine with the id of domid.
Xm destroy <domid> # virtual machines with the id of domid can be destroyed.
Xm console fc5 # log on to the running Virtual Operating System from the terminal or console
Xm save <DomId> <File> # store the status of the running Virtual Operating System
Xm restore <File> # Wake up the Virtual Operating System
Xm pause <DomId> # Stop a running Virtual Operating System
Xm unpause <DomId> # activate the stopped Virtual Operating System
Xm mem-set <DomId> <Mem> # adjust the memory occupied by the virtual platform/Virtual Operating System
Xm shutdown Virtual Operating System Name or DomID # Shut down the Virtual System
Xm destroy <DomId> # Stop a virtual system immediately (important );
Xm vcpu-set <DomId> <VCPUs> # adjust the number of virtual CPUs of the virtual platform and Virtual Operating System
Xm top or xentop # view the running status of the Virtual System
2. The basic usage of virsh is as follows:
Virsh [COMMAND] [ARGS...]
In addition, virsh provides two execution modes: Direct Mode and Interactive Mode )". In direct mode, you must execute virsh using parameters and independent variables in Shell. If in interactive mode, virsh provides a prompt string, you can enter the command to be executed after the prompt string. If the execution of virsh does not specify any parameters or independent variables, the interaction mode is enabled by default.
Like xm, COMMAND is also a COMMAND provided by virsh. Common commands are as follows:
Common commands for virsh are as follows:
Command description
Help to display the description of this command
Quit ends virsh and returns to Shell
Connect to the specified VM Server
Create to start a new Virtual Machine
Destroy deletes a virtual machine
Start enabled (defined) Non-started Virtual Machine
Define defines a virtual machine from XML
Undefine undefined Virtual Machine
Setting Value of dumpxml dumping Virtual Machine
List virtual machines
Reboot restarts the VM.
Save stores the status of the VM
Restore replies to the status of the VM
Suspend pause VM execution
Resume continues executing the VM
Dump dumps the Virtual Machine kernel to a specified file for analysis and troubleshooting
Shutdown VM
Setmem modify memory size
Setmaxmem: set the maximum memory size.
Setvcpus modifies the number of virtual Processors
Recommended reading:
How does XenServer add local storage?
Enable and configure the SNMP service for Citrix XenServer
Install XS-Tools (XenServer) in CentOS/Linux)
XenServer Tutorial: How to Implement hot migration