Search code examples
vagrantvirtualboxvagrantfile

Is it necessary to destroy/rebuild an existing VM to increase its memory?


I am trying to increase the RAM usage of my VM from 512MB to 4GB and have modified the vagrantfile to do exactly that:

config.vm.provider "virtualbox" do |vb|
    vm.memory = "4096"
end

When rebooting the VM, calling free-m reveals that the total RAM has not changed. I've already done quite a bit of work in this environment and would hate to have to restart. Is there anyway to update the RAM while not deleting the environment?

(This issue arose when I ran out of memory for a JVM using MapReduce.)


Solution

  • It looks like a typo issue, you define vb as the variable name but you're calling vm.memory you just need to align

    config.vm.provider "virtualbox" do |vb|
        vb.memory = "4096"
    end