Virtuozzo/OpenVZ vzctl Commands

Useful vzctl commands for your server:

List all VM’s

vzlist -a

Shutdown a specific VM

vzctl stop CTID

Shutdown all VM’s on a node

for ctid in 'vzlist -Ho ctid'; do vzctl stop $ctid; done

Boot a specific VM

vzctl start CTID

Boot all VM’s on a node

for ctid in 'vzlist -Ho ctid'; do vzctl start $ctid; done

Restart a specific VM

vzctl restart CTID

Suspend a specific VM

vzctl set CTID --disabled=yes --save

Suspend all VM’s on a node

for ctid in 'vzlist -SHo ctid'; do vzctl set $ctid --disabled yes --save; done

List the IP addresses assigned to each VM

for CT in $(vzlist -o ctid); do echo "== CT $CT =="; vzctl exec $CT ifconfig | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}' | grep -v ^127; done

Create a vzdump (snapshot) of a specific VM

vzdump CTID --dumpdir /vz/back --tmpdir /vz/test --snapshot
  • /vz/test is the temp directory that the process will use.
  • /vz/back is the directory where the finished snapshot will be placed.

 


Leave a Reply

Your email address will not be published. Required fields are marked *

*

*