Difference between revisions of "Manage VM in console"
Line 46: | Line 46: | ||
get 10 top CPU openvz containers | get 10 top CPU openvz containers | ||
ps -e h -o pid --sort -pcpu | head -10 | vzpid - | ps -e h -o pid --sort -pcpu | head -10 | vzpid - | ||
+ | |||
+ | |||
+ | show PID details containerID owner, users, exe path: | ||
+ | ll /proc/<PID> #or ls -l /proc/<PID> | ||
+ | |||
+ | |||
== '''KVM''' == | == '''KVM''' == |
Revision as of 16:51, 5 March 2015
OpenVZ
Show all OpenVZ containers:
vzlist -a
Show all OVZ templates:
ls /vz/template/cache/
Stop container:
vzctl stop <vmID>
Srart container:
vzctl start <vmID>
Restart container:
vzctl restart <vmID>
Create container:
vzctl create <vmID>
More details about CT creation: http://openvz.org/Configuring_container_creation
ovz container creation example:
vzctl create 115 --ostemplate centos-6-x86
Remove container:
vzctl destroy
For extended description refer to man vzctl. Also we recommend to read Basic operations in OpenZV environment http://openvz.org/Basic_operations_in_OpenVZ_environment
get active vz containers count:
vzlist | wc -l
get containers disk usage in %
vzlist -a -H -o hostname,diskspace,diskspace.s,veid | awk '{ printf( "%2.f%\t%s\t%s\n"), $2*100/$3, $4, $1}' | sort -r
get 10 top CPU openvz containers
ps -e h -o pid --sort -pcpu | head -10 | vzpid -
show PID details containerID owner, users, exe path:
ll /proc/<PID> #or ls -l /proc/<PID>
KVM
Show all Virtual Machines (logical volumes):
lvdisplay
Show state of Virtual Machines:
virsh list --all
Soft shutdown VM. This will sent shutdown command to VMs OS.
virsh shutdown kvm<ID> #for example kvm101
Soft reboot VM
virsh reboot kvm<ID>
Hard power off. This will be equal to unplugging power cord from physical machine.
virsh destroy kvm<ID>
Hard power on
virsh start kvm<ID>
For extended description refer to man virsh.
""