Difference between revisions of "Manage VM in console"
Line 37: | Line 37: | ||
For extended description refer to man vzctl. | 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 | 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 | ||
+ | |||
+ | |||
== '''KVM''' == | == '''KVM''' == |
Revision as of 20:02, 30 September 2014
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
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.
""