Kernel crashes are inevitable in any computing environment, and having a reliable mechanism to capture diagnostic information is crucial for effective troubleshooting and system recovery. In Red Hat Enterprise Linux (RHEL) 9, the Kdump feature provides a powerful solution for capturing kernel crash data. While Kdump is installed by default in RHEL 9, configuring the output location ensures that crash dumps are stored in a location that best suits your environment’s needs.
By default, Kdump files are stored in the /var/crash directory in RHEL 9. However, administrators may want to save crash dumps to other locations, such as NFS mounts, externally mounted drives, or remote file servers. This can be achieved by editing the /etc/kdump.conf file.
To configure the Kdump output location in RHEL 9, follow these steps:
1. Edit the kdump.conf File:
Open the /etc/kdump.conf file in a text editor and remove the # comment character at the beginning of each line that you want to enable. This allows you to specify alternative output locations for Kdump files.
2. Define Output Locations:
Use the path keyword to specify a new directory location for storing Kdump files. For example, to save crash dumps to the /usr/local/cores directory, add the following line to the kdump.conf file:
Additionally, you can use the raw keyword to output directly to a specific device in the /dev directory. You can also specify the output file system for a particular device using its label, name, or UUID.
3. Transfer Kdump Files Over SSH:
Kdump files can also be transferred over a secure shell (SSH) connection. To configure this, specify the SSH connection details and SSH key in the kdump.conf file.
$ ssh email@example.com $ sshkey /root/.ssh/mykey
4. Export Kdump Files to a Network Share:
Another option is to export Kdump files to a compatible network share. This can be achieved by specifying the NFS server and directory in the kdump.conf file.
5. Enable the Kdump Service:
After configuring the output location for Kdump, enable the kdump service to apply the changes.
$ sudo systemctl enable --now kdump.service
By following these steps, administrators can customize the Kdump output location in RHEL 9 to best suit their environment’s requirements. Whether saving crash dumps locally, on remote servers, or network shares, configuring the Kdump output location ensures that critical diagnostic information is readily available for troubleshooting kernel crashes.