Hot add memory to vMA or other supported Linux guestOSes using vSphere ESX(i) 4.0

Hot add memory to vMA or other supported Linux guestOSes using vSphere ESX(i) 4.0

Summary

This document will demonstrate how to hot add memory to a live running vMA (RHEL5) VM using vSphere ESX(i) 4.0, this feature is only supported on certain guestOSes, check vSphere documentation for more information.

Resources

Requirements

ESX(i) 4.0

vMA 4.0 or other supported Linux guestOSes

Instructions

1. Hot add memory requires a VM to be running hardware version 7 and since vMA 4.0 by default is distributed as HW4, you'll need to first right click on the VM and upgrade to hardware 7 before powering on the VM. You will also need to enable hot add memory which is a new configuration item once you've upgraded to HW7 under OPTIONS->Memory/CPU Hotplug and just select 'enable'

2. Power on vMA

3. Let's verify the default memory available within vMA (this can be done using free,/proc/meminfo,top,etc)

[vi-admin@vMa-resize ~]$ free -m
             total       used       free     shared    buffers     cached
Mem:           498        178        320          0          6         98
-/+ buffers/cache:         73        425
Swap:         1023          0       1023

[vi-admin@vMa-resize ~]$ cat /proc/meminfo m
MemTotal:       510668 kB
MemFree:        327696 kB
Buffers:          6740 kB
Cached:         101200 kB
SwapCached:          0 kB
Active:         110392 kB
Inactive:        43864 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       510668 kB
LowFree:        327696 kB
SwapTotal:     1048568 kB
SwapFree:      1048568 kB
Dirty:              24 kB
Writeback:           0 kB
AnonPages:       46340 kB
Mapped:          43704 kB
Slab:            12584 kB
PageTables:       2408 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   1303900 kB
Committed_AS:   222648 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    263328 kB
VmallocChunk: 34359474423 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

Default installation of vMA 4.0 is 512mb of memory, we'll increase this to 1gb

4. You will now use the vSphere Client and edit the vMA's memory and change it from 512mb to 1gb

5. Download and copy online_hotplug_memory.sh to vMA

[root@vMa-resize ~]# chmod +x online_hotplug_memory.sh

6. Execute the script which will find any new memory allocated to vMA and online the memory

[root@vMa-resize ~]# sudo ./online_hotplug_memory.sh
Found sparsemem: "/sys/devices/system/memory/memory0" ...
        memory0 already online
Found sparsemem: "/sys/devices/system/memory/memory1" ...
        memory1 already online
Found sparsemem: "/sys/devices/system/memory/memory2" ...
        memory2 already online
Found sparsemem: "/sys/devices/system/memory/memory3" ...
        memory3 already online
Found sparsemem: "/sys/devices/system/memory/memory4" ...
        memory4 is new memory, onlining memory ...
Found sparsemem: "/sys/devices/system/memory/memory5" ...
        memory5 is new memory, onlining memory ...
Found sparsemem: "/sys/devices/system/memory/memory7" ...
        memory7 is new memory, onlining memory ...

As you can see from the script output memory[0-3] was already allocated and split up but memory[4-7] was the newly added memory which needed to be brought online before the OS can use it.

7. Let's verify the new memory that has been allocated while the VM was running

[root@vMa-resize ~]# free -m
             total       used       free     shared    buffers     cached
Mem:           882        188        694          0          7        100
-/+ buffers/cache:         80        802
Swap:         1023          0       1023

[root@vMa-resize ~]# cat /proc/meminfo
MemTotal:       903884 kB
MemFree:        711128 kB
Buffers:          7644 kB
Cached:         102612 kB
SwapCached:          0 kB
Active:         111996 kB
Inactive:        45060 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       903884 kB
LowFree:        711128 kB
SwapTotal:     1048568 kB
SwapFree:      1048568 kB
Dirty:              36 kB
Writeback:           0 kB
AnonPages:       46836 kB
Mapped:          43708 kB
Slab:            12748 kB
PageTables:       2460 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:   1500508 kB
Committed_AS:   224736 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    263628 kB
VmallocChunk: 34359474423 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

Attachments
Comments

This worked for RHEL 5 64-bit O/S in vSphere ESXi 4.1 as well.  Thanks William!

Version history
Revision #:
1 of 1
Last update:
‎08-09-2009 11:47 AM
Updated by: