OpenVZ commands

Here are a few commands for the OpenVZ usage. They are in no particular order, and also expects bash as a default shell for the memory calculations.

to dump a container
vzdump –compress –snapshot <CID>

to restore a container
vzrestore /path/to/vzdump-<OLD-CID>.tgz <NEW-CID>

to set start on boot (yes/no)
vzctl set <CID> –onboot [yes|no] –save

to set memory limits
vzctl set <CID> –vmguarpages $((256 * 512)) –save #  512MB Dedicated (Guaranteed)
// 512MB * <whatever_MB_you_want>
vzctl set <CID> –privvmpages $((256 * 1024)) –save # 1024 Burst (Granted)
// 1024MB * <whatever_MB_you_want>

to set disk quotas limits (soft:hard)
vzctl set <CID> –diskspace 6G:7G –save


Leave a Reply