I’ve seen quite a lot insufficient CVM memory alerts, this could be caused since our production has grown, our applications demand more recourses and so on, increasing our CVM’s memory is very easy and simple and also Nutanix has a KB found here where you can safely change your CVM’s memory and fix this issue. ( I don’t like calling it an issue but most of the people do)

But since we are adventurous we are going to increase our CVM’s memory by running a script, this is a very simple script were We will be changing CVMs memory from 24GB to 32Gb


Before the script


Important: This script needs to be executed on all AHV hosts


  1. Log into the AHV via SSH.
  2. Create a new file called change-memory.sh
  3. Provide executable permissions. # chmod +x change-memory.sh
  4. Run the script. #./change-memory.sh

Was it hard? do not worry let me be more specific for you.

Detailed instructions:

  • Copy the change-memory.sh script found above.
  • Log in the AHV host where the CVM is running via SSH using e.g. putty
  • Create a file called change-memory.sh and paste the script into the file:
#vi change-memory.sh (to start editor vi and create a new file, feel free to use nano, emacs, vim)

press i (to insert text)
paste the script (putty e.g  Right Click)

  • Change the Memory configuration by going to the RAM line 7 :

type the new amount of RAM e.g RAM=32
save the script by pressing the below characters followed by enter:

  • Make the script executable by running the following command:
# chmod 700 change-memory.sh

Run the script by typing:

# ./change-memory.sh


Log into PRISM and verify your new CVM’s Memory

After running the script:


And We’ve been talking about the script, script, script, and where is it? don’t stress out, here is the magic script.

# Script to change CVM RAM
# Author: Magnus Andersson Staff Solutions Architect at Nutanix
# Version 1.0
# Define amount of RAM needed for the CVM
# Do not change anything below this line
# --------------------------------------
echo Start CVM reconfiguration process
echo ""
# Find CVM
cvm=`/usr/bin/virsh list --all | grep CVM | awk '{print $2}'`
# Shutdown CVM
if /usr/bin/virsh list --all | grep CVM | awk '{print $3}' | grep -i run; then
echo Shutting down CVM: $cvm
/usr/bin/virsh shutdown $cvm
echo CVM not running, proceeding without trying to shut down the CVM
sleep 20
# Get current configuration
if /usr/bin/virsh list --all | grep CVM | awk '{print $3}' | grep -i run; then
echo "The CVM, $cvm, could not be shut down, manual investigation required"
echo "Exiting the script........"
exit 1
echo "Current $cvm RAM (maxmem & mem) configuration in KiB is:"
/usr/bin/virsh dumpxml $cvm | egrep -i "KiB" | awk -F"<" '{print $2}' | awk -F">" '{print $2}'
#echo ""
# Set new configuration
echo Setting new RAM configuration for $cvm
sleep 4
/usr/bin/virsh setmaxmem $cvm --config --size "${RAM}GiB"
/usr/bin/virsh setmem $cvm --config --size "${RAM}GiB"
# Get new configuration
echo "New $cvm RAM (maxmem & mem) configuration in KiB is:"
sleep 10
/usr/bin/virsh dumpxml $cvm | egrep -i "KiB" | awk -F"<" '{print $2}' | awk -F">" '{print $2}'
#echo ""
# Start CVM
echo Starting CVM: $cvm
/usr/bin/virsh start $cvm
# Verify CVM is running
echo Verifying if the CVM is running
sleep 8
if /usr/bin/virsh list --all | grep CVM | awk '{print $3}' | grep -i run;then
echo ""
echo "CVM $cvm is running"
echo "Configuration process finished"
echo "The CVM $cvm is not running! Manual investigation is required...."

or you can download it on here, change the .txt extension to .sh, (do not forget the permissions)

Keep in mind that your CVM will reboot in order to apply the changes.

DO NOT do this on all of your hosts if you are not in a maintenance window.

Hope this was very helpful for you guys,



Thanks to @magander3 for creating that incredible script, Thanks Magnus!

Buy me a coffeeBuy me a coffee