chmem - set memory online or offline.
The chmem command sets a particular size or range of memory online or offline.
- Specify SIZE as <size>[m|M|g|G]. With m or M,
<size> specifies the memory size in MB (1024 x 1024 bytes). With g
or G, <size> specifies the memory size in GB (1024 x 1024 x 1024
bytes). The default unit is MB.
- Specify RANGE in the form 0x<start>-0x<end> as
shown in the output of the lsmem command. <start> is the hexadecimal
address of the first byte and <end> is the hexadecimal address of
the last byte in the memory range.
SIZE and RANGE must be aligned to the Linux memory block size, as shown in the
output of the lsmem command.
Setting memory online can fail if the hypervisor does not have enough memory
left, for example because memory was overcommitted. Setting memory offline can
fail if Linux cannot free the memory. If only part of the requested memory can
be set online or offline, a message tells you how much memory was set online
or offline instead of the requested amount.
- -h, --help
- Print a short help text, then exit.
- -v, --version
- Print the version number, then exit.
- -e, --enable
- Set the given RANGE or SIZE of memory online.
- -d, --disable
- Set the given RANGE or SIZE of memory offline.
- chmem --enable 1024
- This command requests 1024 MB of memory to be set
- chmem -e 2g
- This command requests 2 GB of memory to be set online.
- chmem --disable
- This command requests the memory range starting with
0x00000000e4000000 and ending with 0x00000000f3ffffff to be set