
Operations on Virtual Private Servers
37
Starting, Stopping, Restarting, and
Querying Status of Virtual Private
Server
When a Virtual Private Server is created, it may be started up and shut down like an ordinary
computer. To start Virtual Private Server 101, use the following command:
# vzctl start 101
Starting VPS ...
VPS is mounted
Adding IP address(es): 10.0.186.101
Hostname for VPS 101 set: test.my.org
VPS start in progress...
To check the status of a VPS, use the
vzctl status
vpsid
command:
# vzctl status 101
VPS 101 exist mounted running
Its output shows the following information:
Whether the VPS private area exists;
Whether this private area is mounted;
Whether the Virtual Private Server is running.
In our case,
vzctl
reports that VPS 101 exists, its private area is mounted, and the VPS is
running. Alternatively, you can make use of the
vzlist
utility:
# vzlist 101
VPSID NPROC STATUS IP_ADDR HOSTNAME
101 20 running 10.0.186.101 test.my.org
Still another way of getting the VPS status is checking the
/proc/vz/veinfo
file. This file
lists all the Virtual Private Servers currently running on the Hardware Node. Each line presents
a running Virtual Private Server in the
<VPS_ID> <reserved>
<number_of_processes> <IP_address>
format:
# cat /proc/vz/veinfo
101 0 20 10.0.186.1
0 0 48
This output shows that VPS 101 is running, there are 20 running processes inside the VPS, and
its IP address is 192.168.1.1. Note that second field is reserved; it has no special meaning and
should always be zero.
The last line corresponds to the VPS with ID 0, which is the Hardware Node itself.
The following command is used to stop a Virtual Private Server:
# vzctl stop 101
Stopping VPS ...
VPS was stopped
VPS is unmounted
# vzctl status 101
VPS 101 exist unmounted down