Configuring Kdump

When you install and configure Kdump, the following files are changed:

  • /boot/grub2/grub.cfg: Appends the crashkernel option to the kernel line to specify the amount of reserved memory and any offset value.

  • /etc/kdump.conf: Sets the location in which the dump file can be written, the filtering level for the makedumpfile command, and the default behavior to take if the dump fails. See the comments in the file for information about the enabled parameters.

When you edit these files, you must reboot the system for the changes to take effect.

For more information, see the kdump.conf(5) manual page.

Configuring the Kdump Output Location

After installing Kdump, you can define the location in which the resulting output is saved. For Oracle Linux, Kdump files are stored in the /var/crash directory by default.

  1. Edit the configuration file at /etc/kdump.conf file and remove the # comment character at the beginning of each line that you want to enable.

    For example, to add a new directory location, prefix it with the path keyword:

    path /usr/local/cores

    Use raw to output directly to a specific device in the /dev directory.

    You can also manually specify the output file system for a particular device by using its label, name, or UUID. For example:

    ext4 UUID=5b065be6-9ce0-4154-8bf3-b7c4c7dc7365

    Kdump files can also be transferred over a secure shell connection, as shown in the following example:

    ssh user@example.com
    sshkey /root/.ssh/mykey

    You can also set the Kdump files to be exported to a compatible network share:

    nfs example.com:/output

    See the kdump.conf(5) manual page for more information.

  2. Restart the Kdump service.

    When you have finished configuring the output location for Kdump, restart the kdump service.

    sudo systemctl restart kdump.service

Configuring the Default Kdump Failure State

By default, if kdump fails to send its result to the configured output locations, it reboots the server. This action deletes any data that has been collected for the dump. To prevent this outcome, change the Kdump configuration.

  1. Edit /etc/kdump.conf to uncomment and change the default value in the file as follows:
    default dump_to_rootfs

    The dump_to_rootfs option tries to save the result to a local directory, which can be useful if a network share is unreachable. You can use shell instead to copy the data manually from the command line.

    Note:

    The poweroff, restart, and halt options are also valid for the default kdump failure state. However, performing these actions causes you to lose the collected data if those actions are performed.

  2. Restart the Kdump service.

    When you have finished configuring the output location for Kdump, restart the kdump service.

    sudo systemctl restart kdump.service