Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way of limiting number of cpu cores seen from inside a VE? I have an eight core server, but I want my VE to see only one particular core.


share|improve this question
up vote 9 down vote accepted

If you vz is number 101, than use the following to set it two 2 CPUs (change the number accordingly):

vzctl set 101 --cpus 2 --save

No restart of the VE required. The --save makes it so when the VE is rebooted, the changes will still be there. vzctl --help for other resources that can be set.

share|improve this answer
This does not work with the newer kernels (2.6.32, used in Debian) currently. The same applies to "cpulimit" (documented at – blueyed Oct 14 '10 at 18:27

OpenVZ isn't really virtualization. It's containerization. So each container sees the system that it's on as it's own. To control how much cpu time each VE can get you have to assign each VE cpucredits. This page goes into how set the limits on each VE.

Edit: Just found this in the vzctl man page.
--cpulimit num[%] Limit of CPU usage for the VE, in per cent. Note if the computer has 2 CPUs, it has total of 200% CPU time. Default CPU limit is 0 (no CPU limit). --cpus num sets number of CPUs available in the VE.

So Kyle's answer is correct. But I'll leave this answer here b/c there are more than one nob here to tweak.

share|improve this answer
Might be a better option for his/her unstated end goal as well. – Kyle Brandt Jan 8 '10 at 20:24
If I only had known this last week. I was dealing with CPUUNITS and didn't understood them correctly until too late. Thanks to vzsplit now I have a better performance on my system. – Leandro López Sep 5 '10 at 0:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.