Configuring Kdump
Installing Kdump
The kdump software package does not exist in the local CD/DVD drive source. You need to install kdump by using an external network source.
Ensure that the Debian network source has been configured and can be used properly.
- Run the following command to install the dependency:
# apt-get install kdump-tools crash kexec-tools makedumpfile
- In the displayed dialog box, select Yes and press Enter.
- Select Yes and press Enter. The kdump mode is enabled by default.
If you select No, kdump will not be enabled. You can change USE_KDUMP in the /etc/default/kdump-tools file to USE_KDUMP=1.
Configuring Kdump
- Configuring the kdump memory usage
- Open the /etc/default/grub.d/kdump-tools.cfg file and modify the crashkernel parameter in the GRUB_CMDLINE_LINUX_DEFAULT line, for example:
crashkernel=512M
Set different parameters based on the memory size. The larger the memory size, the larger the reserved memory size. After the modification is complete and the server is restarted, run the dmesg |grep crashkernel command. If the size of the reserved parameter is displayed, the parameter is set correctly and the configuration is successful.
- After the modification, save and close the file.
- Run the following command to update the modification in 1 to the grub.cfg file:
# update-grub
- Open the /etc/default/grub.d/kdump-tools.cfg file and modify the crashkernel parameter in the GRUB_CMDLINE_LINUX_DEFAULT line, for example:
- (Optional) Configuring the kdump data storage location
By default, the kdump data is stored in /var/crash. You can change the value of the KDUMP_COREDIR variable in the /etc/default/kdump-tools file to save the kdump data to another location, for example, /var/crash.
KDUMP_COREDIR=" /usr/local/cores"
Starting the Kdump Service
If kdump is installed for the first time, you need to restart the system to start kdump.
- Run the following command to start the kdump service:
# /etc/init.d/kdump-tools start
- Run the following command to check whether the kdump service is started:
# /etc/init.d/kdump-tools status
If SUCCESS is displayed, the kdump service is started.
Run the following command to view the current kdump configuration:
# kdump-config show
Verifying Kdump
On the Shell CLI, run the following commands:
# echo 1 > /proc/sys/kernel/sysrq
# echo c > /proc/sysrq-trigger
After the preceding commands are run, the Linux kernel breaks down and the kdump file is copied to a specified directory (/var/crash by default).