OpenVZ Cheatsheet

By | 2 June 2020

:: VPS Creation Walkthrough ::

Create VPS from template:
vzctl create id --ostemplate osname

Set VPS to boot on host startup:
vzctl set id --onboot yes --save

Start VPS for further configuration:
vzctl start id

Set VPS hostname:
vzctl set id --hostname --save

Set VPS network settings:
vzctl set id --ipadd ipaddress --save
vzctl set id --nameserver ipnameserver --save

Set password for root user:
vzctl exec id passwd

:: Advanced VE configuration ::

Get VE quota
vzquota stat id

Double VE disk space quota:
vzctl set id --diskspace $(( soft*2 )):$(( hard*2 ))

Double VE inode quota:
vzctl set id --diskinodes $(( soft*2 )):$(( hard*2 ))

Get UBC values:
cat /proc/user_beancounters

Get UBC values for specific VE:
egrep -A23 '^[[:space:]]+${id}:' /proc/user_beancounters

Double UBC values:
vzctl set id --param $(( barrier*2 )):$(( limit*2 ))

Validate configuration:
vzcfgvalidate /etc/vz/conf/id.conf

Go directly into the VE:
vzctl enter id

Stop the VE:
vzctl stop id