Skip to content

Instantly share code, notes, and snippets.

@dublado
Created July 16, 2014 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dublado/9309673aae5cf0fa5305 to your computer and use it in GitHub Desktop.
Save dublado/9309673aae5cf0fa5305 to your computer and use it in GitHub Desktop.
Vagrantfile. Set memory and CPU
To set virtual machine memory size use:
config.vm.customize ["modifyvm", :id, "--memory", 2048]
To set virtual machine CPU's count use:
config.vm.customize ["modifyvm", :id, "--cpus", 2]
or to set half of available CPU's count:
config.vm.customize ["modifyvm", :id, "--cpus", `awk "/^processor/ {++n} END {print n}" /proc/cpuinfo 2> /dev/null || sh -c 'sysctl hw.logicalcpu 2> /dev/null || echo ": 2"' | awk \'{print \$2}\' `.chomp ]
-=-=-=
Here is how i had setup my VagrantFile:
vb.customize ["modifyvm", :id, "--memory", "8192", "--cpus", "2"]
Seems good, but it does not work on 64bits systems.
~ sudo cat /proc/cpuinfo | grep 'processor'
processor : 0 # CPU1
You need another option to be enabled, called ioapic
vb.customize ["modifyvm", :id, "--memory", "8192", "--cpus", "2", "--ioapic", "on"]
Now, with this option, start you VM and…
~ sudo cat /proc/cpuinfo | grep 'processor'
processor : 0 # CPU1
processor : 1 # CPU2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment