Listing the available memory blocks
List the available memory to find out how much memory is available and which memory blocks are online.
Procedure
-
Use the lsmem command to list your memory blocks.
Example:
# lsmem -a Address range Size (MB) State Removable Device =============================================================================== 0x0000000000000000-0x000000000fffffff 256 online no 0 0x0000000010000000-0x000000001fffffff 256 online no 1 0x0000000020000000-0x000000002fffffff 256 online no 2 0x0000000030000000-0x000000003fffffff 256 online yes 3 0x0000000040000000-0x000000004fffffff 256 online yes 4 0x0000000050000000-0x000000005fffffff 256 offline - 5 0x0000000060000000-0x000000006fffffff 256 offline - 6 0x0000000070000000-0x000000007fffffff 256 offline - 7 Memory device size : 256 MB Memory block size : 256 MB Total online memory : 1280 MB Total offline memory: 786 MB
- Alternatively, you can list the available memory blocks
by listing the contents of /sys/devices/system/memory.
Read the state attributes of each memory block
to find out whether it is online or offline. Example: The following command results in an overview for all available memory blocks.
# grep -r --include="state" "line" /sys/devices/system/memory/ /sys/devices/system/memory/memory0/state:online /sys/devices/system/memory/memory1/state:online /sys/devices/system/memory/memory2/state:online /sys/devices/system/memory/memory3/state:online /sys/devices/system/memory/memory4/state:online /sys/devices/system/memory/memory5/state:offline /sys/devices/system/memory/memory6/state:offline /sys/devices/system/memory/memory7/state:offline
Note: Online blocks are in use by your Linux® instance. An offline block can be free to be added to your Linux instance but it might also be in use by another Linux instance.