A Kernel Crash Dump refers to a portion of the contents of volatile memory (RAM) that is copied to disk whenever the execution of the kernel is disrupted. The following events can cause a kernel disruption :
- Kernel Panic
- Non Maskable Interrupts (NMI)
- Machine Check Exceptions (MCE)
- Hardware failure
- Manual intervention
For some of those events (panic, NMI) the kernel will react automatically and trigger the crash dump mechanism through kexec. In other situations a manual intervention is required in order to capture the memory. Whenever one of the above events occurs, it is important to find out the root cause in order to prevent it from happening again. The cause can be determined by inspecting the copied memory contents.
To enable this within Ubuntu first we have to install the correct package:
sudo apt-get install linux-crashdump
No further configuration is required as installing the package will also write to the boot loader configuration and alter the kernel boot parameters to include:
crashkernel=384M-2G:64M,2G-:128M
This option will reserve no memory for crash-dump when we have less the 384MB of RAM, if we have between 384MB and 2GB RAM than we reserve 64MB for the crash-dump and above 2Gb we reserve 128MB. To make these changes effective we will need a reboot and that is it 🙂