Posts

Showing posts with the label OpenVZ

OpenVZ operation commands

This note includes useful commands to adjust guest OS resources allocation at OpenVZ environment. Monitor kmemsize usages cat /proc/user_beancounters Version: 2.5 uid resource held maxheld barrier limit failcnt vm01: kmemsize 836919 1005343 2752512 2936012 0 May increase the barrier and limit vzctl set vm01 --kmemsize [barrier in number]:[limit in number] --save Validate config vzcfgvalidate /etc/vz/conf/vm01.conf Monitor Disk usage vzquota stat vm01 resource usage softlimit hardlimit grace 1k-blocks 327664 1048576 1153434 inodes 18857 200000 220000 Increase diskspace vzctl set vm01 --diskspace 20G:25G --save Increase double of inodes vzctl set vm01 --diskinodes $(( 200000*2 )):$(( 220000*2 )) --save Set CPU allocation vzctl set vm01 --cpuunits 1000 --save vzctl set vm02 --cpuunits 1000 --save vzctl set vm03 --cpuunits 200...

Migrate physical system to OpenVZ container

In this lab, we already install Openvz container kernel at host system. Create new empty VM mkdir /vz/root/101 /vz/private/101 cat /etc/vz/conf/ve-vps.basic.conf-sample > /etc/vz/conf/101.conf Copy data from Physical to VM directory rsync -arvpz --numeric-ids --exclude dev --exclude proc --exclude tmp --exclude sys --exclude mnt -e "ssh -l root@x.x.x.x" root@x.x.x.x:/ /vz/private/101/ Create /etc/vz/conf/101.conf VE_ROOT="/vz/root/$VEID" VE_PRIVATE="/vz/private/$VEID" OSTEMPLATE="centos-5" IP_ADDRESS="192.168.1.1" HOSTNAME="penguin" NAMESERVER="8.8.8.8" #Making adjustments Edit /vz/private/101/etc/inittab sed -i -e '/getty/d' /vz/private/101/etc/inittab Edit /vz/private/101/etc/mtab rm -f /vz/private/101/etc/mtab ln -s /proc/mounts /vz/private/101/etc/mtab Edit /vz/private/101/etc/fstab cp /vz/private/101/etc/fstab /vz/private/101/etc/fstab.old grep devpts /vz/private/101/etc/f...