All Products
Search
Document Center

Alibaba Cloud Linux:Configure the crashkernel parameter

Last Updated:Oct 23, 2024

The crashkernel parameter is used in Linux to reserve a proportion of memory for the kdump service to capture memory dump files when a system crash occurs. System administrators can use the files to perform post-failure analysis to quickly identify and resolve kernel-level issues. This topic describes how to configure the crashkernel parameter.

Limits on operating systems

  • Alibaba Cloud Linux 3

  • Alibaba Cloud Linux 2

Crashkernel parameter

By default, the crashkernel parameter is configured in the cmdline in Alibaba Cloud Linux 2 and 3.

Architecture

Operating system

Default value

x86

Alibaba Cloud Linux 3

crashkernel=0M-2G:0M,2G-8G:192M,8G-128G:256M,128G-:384M

Alibaba Cloud Linux 2

ARM64

Alibaba Cloud Linux3

crashkernel=0M-2G:0M,2G-64G:256M,64G-:384M

Use different syntax of the crashkernel parameter

  • Reserve memory with a certain offset by using the following syntax:

    crashkernel=size[KMG][@offset[KMG]]

    Example: crashkernel=256M@32M, which specifies that 256 MB of memory starting at 32 MB is reserved.

  • Reseve memory based on the total amount of system memory by using the following syntax:

    crashkernel=range1:size1[,range2:size2,...][@offset]

    Example: crashkernel=0M-2G:0M,2G-64G:256M,64G-:384M, which specifies that:

    • Memory is not reserved if the total amount of system memory is less than or equal to 2 GB.

    • 256 MB of memory is reserved if the total amount of system memory is more than 2 GB but does not exceed 64 GB.

    • 384 MB of memory is reserved if the total amount of system memory is more than 64 GB.

  • Reserve high memory (highmem) or low memory (lowmem) by using the following syntax:

    crashkernel=size[KMG],low/high

    Example: crashkernel=256M,high, which specifies that 256 MB of high memory space is reserved.

Change the crashkernel parameter

  1. Change the crashkernel parameter.

    Replace <crashkernel> with a specific value based on your business requirements. Example: 256M.

    sudo grubby --update-kernel="/boot/vmlinuz-$(uname -r)" --args="crashkernel=<crashkernel>"
  2. Restart the instance for the change to take effect.

    Warning

    The restart operation stops the instances for a brief period of time and may interrupt the services that are running on the instance, which may result in data loss. Before you restart your instance, we recommend that you back up critical instance data. We also recommend that you restart the instance during off-peak hours.

    sudo reboot
  3. Check the amount of reserved memory after the crashkernel parameter is modified.

    sudo kdumpctl showmem

Use the kdump service

Note

Before you use the kdump service, make sure that the total amount of system memory is more than 2 GB.

  • Check the status of the kdump service.

    sudo systemctl status kdump
  • Enable or disable the kdump service.

    • Disable the kdump service.

      sudo systemctl stop kdump
    • Enable the kdump service.

      sudo systemctl start kdump