Hot Adding CPU’s to a linux Virtual Machine (ESX) without restarting

Hi All,

so i wanted to add some more processing power to a vm i am running without restarting it but didnt know how.
a quick google search shows that vmware has created a script to do this for you, but i wanted to know how to do it my self.
so a quick check of the script and it does the following.

  1. lists the idle cpu’s by running the following commmand
    1. ls /sys/devices/system/cpu/ | grep cpu | grep -v idle
      1. in my case this showed cpu2, cpu3
  2. then activating those cpu’s by running
    1. echo 1 > /sys/devices/system/cpu/cpu2
    2. echo 1 > /sys/devices/system/cpu/cpu3

a quick run of htop shows all 4 processes now working correctly without restarting.

dont you just love linux 😀