Kernel Crash Dumps

There are a lot of posts about kdump you'll find on Google, but most are distro-specific and leave out how to actually make it work if it isn't already configured. The best post I've found is this one, which this procedure is largely based on.

To keep things simple I'm going to just use a single kernel for the system and recovery, which creates just a few limitations on your kernel configuration.

This is a mandatory package.

Check your kernel configuration for the following settings:

Edit your grub.conf and add to your boot line crashkernel=64M for up to around 12GB of system RAM Create /etc/local.d/kdump.start containing (don't forget to chmod it a+x): /etc/local.d/kdump.start

That's it. Note that your kernel has to be reachable, and the typical gentoo config leaves /boot unmounted, so you'll either need to remove noauto from your fstab or place a copy of your kernel elsewhere.

I didn't get this working with an initramfs - this is supposed to be possible but obviously the more complexity the trickier.

With these changes whenever you get a kernel panic or lockup (hard/soft if the kernel is set to detect them) the system will use kexec to run the kernel in crash mode, relocated to a reserved area of memory. The rest of RAM will be untouched. When the system boots up log in and copy /proc/vmcore to a file - this is your crash dump. Then reboot your system to get back to a normal configuration - you shouldn't continue to operate in this state.