Hot Adding CPU’s to a linux Virtual Machine

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.

lists the idle cpu’s by running the following commmand
ls /sys/devices/system/cpu/ | grep cpu | grep -v idle
in my case this showed cpu2, cpu3
then activating those cpu’s by running
echo 1 > /sys/devices/system/cpu/cpu2
echo 1 > /sys/devices/system/cpu/cpu3
a quick run of htop shows all 4 processes now working correctly without restarting.

don’t you just love linux 🙂

Enjoy

Leave a Reply

Your email address will not be published. Required fields are marked *