Citrix XenServer: how to add RAM to a guest VM without XenCenter?

In XenServer 6.0, this can be done with the vm-memory-limits-set command:

[root@localhost 1274]# xe help vm-memory-limits-set
command name            : vm-memory-limits-set
        reqd params     : static-min, static-max, dynamic-min, dynamic-max
        optional params : <vm-selectors>
        description     : Configure the memory limits of a VM. The simplest way to select the VM on which the operation is to be performed is by supplying the argument 'vm=<name or uuid>'. VMs can also be specified by filtering the full list of VMs on the values of fields. For example, specifying 'power-state=halted' will select all VMs whose power-state field is equal to 'halted'. Where multiple VMs are matching, the option '--multiple' must be specified to perform the operation. The full list of fields that can be matched can be obtained by the command 'xe vm-list params=all'. If no parameters to select VMs are given, the operation will be performed on all VMs.

Assuming the VM is powered down, here is an example of actually using it:

[root@localhost 1274]# xe vm-list name-label=Local-PerformanceVM params=all |grep memory
                 memory-actual ( RO): 0
                 memory-target ( RO): <expensive field>
               memory-overhead ( RO): 4194304
             memory-static-max ( RW): 268435456
            memory-dynamic-max ( RW): 268435456
            memory-dynamic-min ( RW): 268435456
             memory-static-min ( RW): 16777216
               recommendations ( RO): <restrictions><restriction field="memory-static-max" max="34359738368" /><restriction field="vcpus-max" max="8" /><restriction property="number-of-vbds" max="7" /><restriction property="number-of-vifs" max="7" /></restrictions>
                        memory (MRO):
[root@localhost 1274]# xe vm-memory-limits-set dynamic-max=300000000 dynamic-min=300000000 static-max=300000000 static-min=16777216 name-label=Local-PerformanceVM
[root@localhost 1274]# xe vm-list name-label=Local-PerformanceVM params=all |grep memory
                 memory-actual ( RO): 0
                 memory-target ( RO): <expensive field>
               memory-overhead ( RO): 5242880
             memory-static-max ( RW): 300000000
            memory-dynamic-max ( RW): 300000000
            memory-dynamic-min ( RW): 300000000
             memory-static-min ( RW): 16777216
               recommendations ( RO): <restrictions><restriction field="memory-static-max" max="34359738368" /><restriction field="vcpus-max" max="8" /><restriction property="number-of-vbds" max="7" /><restriction property="number-of-vifs" max="7" /></restrictions>
                        memory (MRO):
[root@localhost 1274]#

I'm a bit new to XenServer, so I've never had to try this, but there appear to be XE commands for updating the dynamic memory config, but I think that's limited to the pay versions.

It's probably a bit long to paste here, but check out pages 66-67 of the 5.6 SP2 Admin guide here: http://support.citrix.com/servlet/KbServlet/download/27187-102-658234/reference.pdf

If you're using an older version without dynamic memory, all of the XenServer admin guides are here, just select the version, then the Documentation tab, then the Administrators guide: http://support.citrix.com/product/xens/


These are the commands I ran to up the memory on my nameserver VM.

xe vm-shutdown name-label="WINS Nameserver"
xe vm-list params=all name-label="WINS Nameserver" | grep memory
xe vm-list params=uuid name-label="WINS Nameserver"
xe vm-param-set memory-static-max=668435456 memory-dynamic-max=668435456 memory-dynamic-min=668435456 uuid=ffffb8a9-ffff-ffff-2df1-fffc9bd9688a
xe vm-start name-label="WINS Nameserver"

The start and stop commands are "blocking" aka they wait till the vm shuts down before returning. This means you can run these commands as fast as possible and it will work fine.

If you already know the uuid if your vm, you can use "uuid=" in-place of the "name-label=" option. Also note: if you know the first 3 characters of your uuid, you can press tab and XenServer will auto-complete the rest for you!