Note 452067.1 &n…

原文地址:Note 452067.1  "How to Configure "kdump" on&nb 作者:Hello顾问
In this Document
  Goal
  Solution
        How to Configure Kdump
  References

Applies to:
Linux OS - Version: Oracle Linux 5.0 to Oracle Linux 5.6 - Release: OL5 to OL5U6
Linux x86
Linux x86-64
Oracle Linux 5
Goal
Kdump is the kernel crash dumping mechanism for Oracle Linux 5 - it provides a memory dump (vmcore) when the kernel experiences a critical condition. This document provides step-by-step instructions on how to configure kdump on Oracle Linux.
Solution
How to Configure Kdump
1. Install the kexec-tools package if not already installed

      Kexec is a fastboot mechanism which allows booting a Linux kernel from the context of already running kernel without going through BIOS. Kdump uses kexec to boot into a second kernel whenever the system crashes.

#  up2date --nox -u kexec-tools
Fetching Obsoletes list for channel: el5_i386_latest...
########################################
Fetching rpm headers...
########################################
Name                                                                      Version              Rel
----------------------------------------------------------
kexec-tools                                                        1.101                  194.4.el5.0.1        i386
Testing package set / solving RPM inter-dependencies...
########################################
kexec-tools-1.101-194.4.el5 ########################## Done.
Preparing                          ########################################### [100%]
Installing...
    1:kexec-tools        ########################################### [100%]
#

2. Check the file /boot/config-`uname -r`

The values specified should denote that kexec is enabled and this kernel can be used as a crash kernel:
CONFIG_KEXEC=y
CONFIG_CRASH_DUMP=y
...

3. Modify the system kernel to reserve space for the crash kernel

      Edit the /etc/grub.conf file and add "crashkernel=128M@16M" to the kernel line to reserve 128MB of memory, starting at physical address 0x01000000 (16MB)

# vi /etc/grub.conf
  ...
title Red Hat Enterprise Linux Server (2.6.18-8.el5)
              root (hd0,0)
              kernel /vmlinuz-2.6.18-8.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet crashkernel=128M@16M
              initrd /initrd-2.6.18-8.el5.img
  ...

4. Specify where the vmcore should be created

      Different types of dump target locations can be specified in the /etc/kdump.conf file
      Following is a sample entry that uses NFS as the location for the dump target. For example, below will mount the filesystem and copy the vmcore file to the NFS server

      net my.server.com:/export/tmp

      For more options, please check the /etc/kdump.conf.

5. Update kdump configuration file - /etc/sysconfig/kdump

      This file defines the dump-capture kernel specification, including its name/location, and command line for the kernel if it is to be different from the currently running kernel.

# cat /etc/sysconfig/kdump
KDUMP_KERNELVER=""
KDUMP_COMMANDLINE=""
KDUMP_COMMANDLINE_APPEND="irqpoll maxcpus=1"
KEXEC_ARGS=" --args-linux"
KDUMP_BOOTDIR="/boot"
KDUMP_IMG="vmlinuz"


      KDUMP_COMMANDLINE modify the default crash kernel command line from /proc/cmdline
      KDUMP_COMMANDLINE_APPEND adds irqpoll and maxcpus=1 to the command line for the crash kernel
      KEXEC_ARGS adds --args-linux to the kexec command line
      KDUMP_BOOTDIR is set to /boot
      KDUMP_IMG specifies the crash kernel image name, defaulting to /boot/vmlinuz with the current kernel version appended

6. Enable the kdump service:
#  chkconfig kdump on
#

Note: it cannot be started as the new kernel parameter is not yet in effect.

7. Reboot the system for kdump configuration to take effect. Verify that kdump is active:
# cat /proc/cmdline
ro root=/dev/VolGroup00/LogVol00 rhgb quiet crashkernel=128M@16M

# /etc/init.d/kdump  status
Kdump is operational

# /sbin/chkconfig --list |grep kdump
kdump                    0:off    1:off    2:on      3:on      4:on      5:on      6:off


8. Test kdump by crashing the system:
# echo c > /proc/sysrq-trigger

This causes the kernel to panic, followed by the system restarting into the kdump kernel. When the boot process gets to the point where it starts the kdump service, the vmcore file should be copied to disk to the location specified in the /etc/kdump.conf file.

你可能感兴趣的:(Note 452067.1 &n…)