OpenVZ Commands

To start a VPS

vzctl start <VPSID>

To Stop a VPS

vzctl stop <VPSID>

To Restart a VPS

vzctl restart <VPSID>

To Delete a VPS (all data will be deleted, no confirmation, so be careful)

vzctl destroy <VPSID>

To show resources used by a VPS

vzcalc -v <VPSID>
[root@server12 ~]# vzcalc -v 244
Resource     Current(%)  Promised(%)  Max(%)
Low Mem          0.12       3.96       3.96
Total RAM        1.88        n/a        n/a
Mem + Swap       1.67       2.54        n/a
Alloc. Mem       2.53       2.87      40.47
Num. Proc        0.02        n/a       0.72
--------------------------------------------
Memory           2.53       3.96      40.47
[root@server12 ~]#

To list all running VPS

vzlist

To list all VPS

vzlist -a

To check CPU usage by OpenVZ, Run vzcpucheck

[root@server12 ~]# vzcpucheck
Current CPU utilization: 3000
Power of the node: 478753
[root@server12 ~]#

To get CPU usage per VPS, run vzcpucheck -v

[root@server12 ~]# vzcpucheck -v
VEID            CPUUNITS
-------------------------
0               1000
103             1000
233             1000
Current CPU utilization: 3000
Power of the node: 478753
[root@server12 ~]#

To execute a command inside VPS

[root@server12 ~]# vzctl exec 103 df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/simfs           104857600  66230024  38627576  64% /
[root@server12 ~]# vzctl exec 103 uptime
 13:01:49 up 25 min,  0 users,  load average: 0.00, 0.00, 0.00
[root@server12 ~]#

Posted in Virtualization