If you manage servers that use OpenVZ (Virtuozzo), chances are you’ll spend a lot of time working with vzctl to start, stop, and maintain containers (CTs). While modern virtualization has largely moved on to KVM, Docker, and LXC, plenty of production systems still rely on OpenVZ — especially for legacy applications.
This is a quick reference of essential vzctl commands for day-to-day container administration.
List All Containers
vzlist -a
Displays all containers, including stopped ones.
Start and Stop Containers
Stop a specific container:
vzctl stop CTID
Stop all containers on a node:
for ctid in $(vzlist -Ho ctid); do vzctl stop $ctid; done
Start a specific container:
vzctl start CTID
Start all containers on a node:
for ctid in $(vzlist -Ho ctid); do vzctl start $ctid; done
Restart a container:
vzctl restart CTID
Suspend Containers
Suspend a specific container:
vzctl set CTID --disabled yes --save
Suspend all containers on a node:
for ctid in $(vzlist -SHo ctid); do vzctl set $ctid --disabled yes --save; done
Networking
List IP addresses assigned to each container, excluding loopback:
for CT in $(vzlist -o ctid); do
echo "== CT $CT =="
vzctl exec $CT ifconfig | grep 'inet addr:' | cut -d : -f 2 | awk '{print $1}' | grep -v ^127
done
Backups
Create a snapshot of a specific container with vzdump:
vzdump CTID --dumpdir /vz/back --tmpdir /vz/test --snapshot
/vz/test— Temporary working directory used during the dump/vz/back— Directory where the final snapshot is saved
Closing Notes
OpenVZ remains widely deployed in production environments where lightweight containerization and minimal overhead are priorities. Keep this cheat sheet handy when managing multiple containers on the same host.