Let’s see the steps for configuring kdump on the command line in Centos. Bobcares, as a part of our Server Management Services, offers solutions to every query that comes our way.
Steps for configuring kdump on the command line Centos
The kdump is a robust crash-dumping method. When enabled, the system boots from another kernel’s context. This second kernel sets aside a tiny amount of RAM for the sole purpose of capturing the core dump image if the system crashes.
It is strongly advised to enable this option. As it allows evaluation of the core dump which helps in determining the specific reason for the system failure. Let’s see the steps to configure kdump on the Centos Command-Line.
Step 1
Firstly, we have to download and install the kexec-tools package to use kdump. We can use the following code:
# yum install kexec-tools
Step 2
1. We have to set up memory usage in GRUB2. To configure memory for kdump, we have to modify /etc/default/grub
and GRUB_CMDLINE_LINUX
.
2. Also, set the crashkernel=[size] parameter to the list of kernel options.
GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=128M vconsole.keymap=us rhgb quiet" GRUB_DISABLE_RECOVERY="true"
3. To regenerate the grub configuration, we use the below code:
# grub2-mkconfig -o /boot/grub2/grub.cfg
4. Finally, reboot the system.
# shutdown -r now
Step 3
1. We have to configure the dump location. To edit the configuration file /etc/kdump.conf
file. The vmcore file is normally stored in the /var/crash/ directory of the local file system. Replace the value with the appropriate directory path to alter the local directory which is the location of the core dump.
2. Remove the hash sign (“#”) from the beginning of the #nfs my.server.com:/export/tmp
line. Replace the value with a valid hostname and directory path to save the dump to a remote computer using the NFS protocol.
Step 4
To activate the core collector, change the configuration file /etc/kdump.conf
by removing the hash sign (“#”) at the start of the #core_collector makedumpfile -c –message-level 1 -d 31
line and editing the command line arguments.
Step 5
We may additionally define what happens if the core dump fails to create at the specified place. If there is no default action, the action “reboot” is presumed to be the default.
Step 6
1. Check to ensure that the kernel command line includes the kdump configuration and that memory has been set aside for the crash kernel using the below code:
# cat /proc/cmdline BOOT_IMAGE=/vmlinuz-3.8.13-98.2.1.el7uek.x86_64 root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/root crashkernel=128M rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet nomodeset
2. Configure in such a way that when the system reboots, the kdump service should start.
# systemctl enable kdump.service
3. Use the following command to start the service in the current session:
# systemctl start kdump.service
Step 7
1. We can test the setup by rebooting the system with kdump enabled and ensuring that the service is running. E.g,
# systemctl is-active kdump active
# service kdump status Redirecting to /bin/systemctl status kdump.service kdump.service - Crash recovery kernel arming Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled) Active: active (exited) since 一 2015-08-31 05:12:57 GMT; 1min 6s ago Process: 19104 ExecStop=/usr/bin/kdumpctl stop (code=exited, status=0/SUCCESS) Process: 19116 ExecStart=/usr/bin/kdumpctl start (code=exited, status=0/SUCCESS) Main PID: 19116 (code=exited, status=0/SUCCESS) Aug 31 05:12:57 ol7 kdumpctl[19116]: kexec: loaded kdump kernel Aug 31 05:12:57 ol7 kdumpctl[19116]: Starting kdump: [OK] Aug 31 05:12:57 ol7 systemd[1]: Started Crash recovery kernel arming.
2. Then, at a shell prompt, we must enter the below codes:
# echo 1 > /proc/sys/kernel/sysrq # echo c > /proc/sysrq-trigger
This will cause the Linux kernel to crash, and the address-YYYY-MM-DD-HH:MM:SS/vmcore
file will be copied to the destination specified in the settings (by default, /var/crash/).
[Looking for a solution to another query? We are just a click away.]
Conclusion
In this article, we provided a simple 7-step method from our Tech team for configuring kdump on the Command Line Centos.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
var google_conversion_label = "owonCMyG5nEQ0aD71QM";
0 Comments