Setting up kdump

Before you can use kdump, you must load the kdump kernel into a reserved memory area.

Before you begin

  • The steps that are described here are typically done for you by your distribution or through distribution-specific configuration tools.
  • You need a kdump kernel image and initial RAM disk.
  • The kexec-tools package must be installed.

About this task

The reserved memory area must be sufficiently large to accommodate the kdump system, including user space, when it is booted. If too little memory is reserved, kdump itself crashes if booted (see Failure recovery and backup tools).

Procedure

  1. For your production system, code the crashkernel= kernel parameter according to this syntax:
    crashkernel=<size>@<offset>
    where <size> specifies the amount of memory to be reserved and <offset> the beginning of the memory range. The values are integers, optionally followed by K for kilobyte, M for megabyte, or G for gigabyte. The values are adjusted to multiples of 1 MB.

    The specified memory area, <offset> through <offset> + <size>, and a corresponding memory area 0 through <size>, must both be available and must both not contain any memory holes.

    If you omit @<offset>, a suitable offset is chosen for you. If you specify an offset, it must be greater than the size of the reserved memory.

    For example, the following specification reserves 128 MB for the kdump kernel at an automatically selected suitable offset.
    crashkernel=128M
    The following specification reserves 128 MB for the kdump kernel at an offset of 256 MB.
    crashkernel=128M@256M

    Optionally, you can make the specification of reserved memory size and offset dependent on the size of the available memory. See Documentation/kernelparameters.txt in the Linux® source tree for details about how to do this and about further details of the crashkernel= kernel parameter.

  2. Boot your production system.
  3. Optional: Issue the following command to confirm that a memory area was reserved for the kdump kernel:
    # cat /proc/iomem
    The command output must include a memory range for Crash kernel.
  4. Load the kdump kernel with the kexec command according to this syntax:
    # kexec -a -p <image> --initrd <initrd> --command-line "<kparms>"
    where:
    <image>
    specifies the kdump kernel image.
    <initrd>
    specifies the initial RAM disk of the kdump kernel. This specification can be omitted if the kdump kernel does not require an initial RAM disk.
    <kparms>
    specifies kernel parameters for the kdump kernel.
    -a
    specifies that kexec should use an advanced kexec load function, if available. If the advanced function is not available, kexec falls back to the default load function. This is the preferred method of calling kexec.
    -s
    is an optional parameter that uses an advanced kexec load function. This function enables the current kernel to check the validity of the kdump kernel before loading it.
    Example:
    # kexec -a /boot/kdump.image --initrd /boot/kdump.initrd \
    --command-line="dasd=eb90 root=/dev/ram0 maxcpus=1"

Results

A kernel panic or PSW restart now triggers an automatic dump process with kdump.

What to do next

As a backup, you can set up a stand-alone dump tool in addition to kdump. See The dumpconf service about how to run a backup tool automatically, if kdump fails.