OpenVZ (Virtuozzo) vzctl Commands: Quick Reference

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 guide provides 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:
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
This will output each container’s IP(s), excluding loopback addresses.
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.
Final Thoughts
OpenVZ may be a legacy platform, but it remains widely used in production environments where lightweight containerization and minimal overhead are essential. Having a vzctl
quick reference can save you time and frustration when working with multiple containers on the same host.
Keep this cheat sheet handy, and you’ll be able to manage your VMs more efficiently.
Comments ()