This guide explains how to set up kdump to store crash dumps on a remote server through SSH.
Configuring kdump to save vmcore on a remote server via SSH guarantees crash dumps are securely stored off-site for reliable analysis, even if the local system becomes unusable.
Follow the steps:
- Make the RSA Key Pair for Kdump:
- If an RSA key does not already exist, generate one:
ssh-keygen -t rsa
- Then, copy the private key for use with kdump:
cp /root/.ssh/id_rsa /root/.ssh/kdump_id_rsa
- Next, copy the corresponding public key to the remote server (where vmcore will be stored), and verify SSH connectivity:
ssh-copy-id -i /root/.ssh/id_rsa.pub root@<remote-server> ssh -i /root/.ssh/kdump_id_rsa root@<remote-server>
- If an RSA key does not already exist, generate one:
- Configure Kdump:
- Edit the /etc/kdump.conf file with the following configuration:
sshkey /root/.ssh/kdump_id_rsa ssh root@<ip_or_hostname_of_remote_server> core_collector makedumpfile -F -l --message-level 1 -d 31 force_rebuild 1
Note: Comment out or remove any other unrelated parameters.
- Also, update the kdump system configuration:
echo ‘MKDUMPRD_ARGS= “--builtin=libafs”’ >> /etc/sysconfig/kdump
- Edit the /etc/kdump.conf file with the following configuration:
- Restart the Kdump Service:
- Apply the new settings by restarting kdump:
# systemctl restart kdump
- After a successful restart, you can remove the “force_rebuild 1” line from “/etc/kdump.conf”.
- Apply the new settings by restarting kdump:
- Optional, Test the Configuration:
- If you have a test environment, verify the setup by simulating a kernel crash:
echo c > /proc/sysrq-trigger
- To enable verbose kernel messages (useful for debugging), run:
sysctl kernel.printk=7
- If you have a test environment, verify the setup by simulating a kernel crash:
After finishing all steps, monitor for future crashes to confirm that the vmcore files are properly captured and transferred to the remote server.
Need to manage backups too? Learn How to Download a Database Dump in Plesk