1
  ,   ˆl–äY>”ÊC]Šq@½p!¸ )‹FÿÀ„i—Àß_‡I|¥ŠèªÃÅ ?÷     =================
Kexec/Kdump HOWTO
=================


Introduction
============

Kexec and kdump are new features in the 2.6 mainstream kernel. These features
are included in Red Hat Enterprise Linux 5. The purpose of these features
is to ensure faster boot up and creation of reliable kernel vmcores for
diagnostic purposes.


Overview
========

Kexec
-----

Kexec is a fastboot mechanism which allows booting a Linux kernel from the
context of already running kernel without going through BIOS. BIOS can be very
time consuming especially on the big servers with lots of peripherals. This can
save a lot of time for developers who end up booting a machine numerous times.

Kdump
-----

Kdump is a new kernel crash dumping mechanism and is very reliable because
the crash dump is captured from the context of a freshly booted kernel and
not from the context of the crashed kernel. Kdump uses kexec to boot into
a second kernel whenever system crashes. This second kernel, often called
a capture kernel, boots with very little memory and captures the dump image.

The first kernel reserves a section of memory that the second kernel uses
to boot. Kexec enables booting the capture kernel without going through BIOS
hence contents of first kernel's memory are preserved, which is essentially
the kernel crash dump.

Kdump is supported on the i686, x86_64, ia64 and ppc64 platforms. The
standard kernel and capture kernel are one in the same on i686, x86_64,
ia64 and ppc64.

If you're reading this document, you should already have kexec-tools
installed. If not, you install it via the following command:

    # dnf install kexec-tools

Now load a kernel with kexec:

    # kver=`uname -r` # kexec -l /boot/vmlinuz-$kver
    --initrd=/boot/initrd-$kver.img \
        --command-line="`cat /proc/cmdline`"

NOTE: The above will boot you back into the kernel you're currently running,
if you want to load a different kernel, substitute it in place of `uname -r`.

Now reboot your system, taking note that it should bypass the BIOS:

    # reboot


How to configure kdump
======================

Again, we assume if you're reading this document, you should already have
kexec-tools installed. If not, you install it via the following command:

    # dnf install kexec-tools

To be able to do much of anything interesting in the way of debug analysis,
you'll also need to install the kernel-debuginfo package, of the same arch
as your running kernel, and the crash utility:

    # dnf --enablerepo=\*debuginfo install kernel-debuginfo.$(uname -m) crash

Next up, we need to reserve a chunk of memory for the capture kernel. To use
the default crashkernel value, you can kdumpctl:

    # kdumpctl reset-crashkernel --kernel=/boot/vmlinuz-`uname -r`

If the default value does not work for your setup you can use

  # grubby --args="crashkernel=256M" --update-kernel=/boot/vmlinuz-`uname -r`

to specify a larger value, in this case 256M. You need to experiment to
find the best value that works for your setup. To begin with

  # kdumpctl estimate

gives you an estimation for the crashkernel value based on the currently
running kernel. For more details, please refer to the "Estimate crashkernel"
section in /usr/share/doc/kexec-tools/crashkernel-howto.txt.

Note that there is an alternative form in which to specify a crashkernel
memory reservation, in the event that more control is needed over the size and
placement of the reserved memory.  The format is:

crashkernel=range1:size1[,range2:size2,...][@offset]

Where range<n> specifies a range of values that are matched against the amount
of physical RAM present in the system, and the corresponding size<n> value
specifies the amount of kexec memory to reserve.  For example:

crashkernel=512M-2G:64M,2G-:128M

This line tells kexec to reserve 64M of ram if the system contains between
512M and 2G of physical memory.  If the system contains 2G or more of physical
memory, 128M should be reserved.

Besides, since kdump needs to access /proc/kallsyms during a kernel
loading if K