Kdump of RedHat5 is very detailed

Source: Internet
Author: User
Tags ssh server
HowdoIconfigurekexec/kdumponRedHatEnterpriseLinux5? ReleaseFound: RedHatEnterpriseLinux5Note: forvirtualizedguests, xendumpmustbeused. PleaseseethearticleHowdoIconfigure

How do I configure kexec/kdump on Red Hat Enterprise Linux 5?
Release Found: Red Hat Enterprise Linux 5

Note: for your alized guests, xendump must be used. Please see the article How do I configure Xendump on Red Hat Enterprise Linux 5 ?.

Overview

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


Kdump is a new kernel crash dumping mechanic and is very reliable. 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 the 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. be aware that the kdump reserves a significant amount of memory at the boot time, which changes the actual minimum memory requirements of Red Hat Enterprise Linux 5. to compute the actual minimum memory requirements for a system, refer to http://www.RedHat.com/rhel/details/limits/ for the listed minimum memory requirements and add the amount of memory used by kdump to determine the actual minimum memory requirements.


Kexec enables booting the capture kernel without going through BIOS hence the contents of the first kernel's memory are preserved, which is essential to the kernel crash dump.


Installing Kdump

Verify the kexec-tools package is installed:


 
# Rpm-q kexec-tools
 
If it is not installed proceed to install it via yum:

 
# Yum install kexec-tools


Specifying Kdump Location

The location of the Kdump vmcore must be specified in/etc/kdump. conf. not specifying the vmcore location will result in undefined behavior. you can either dump directly to a device, to a file, or to some location on the network via NFS or SSH.


Dumping Directly to a Device

You can configure Kdump to dump directly to a device by using the raw directive in kdump. conf. The syntax to be used is


Raw devicename
For example:


 
Raw/dev/sda1
 

Please be aware that this will overwrite any data that was previusly on the device.


Dumping to a file on Disk

Kdump can be configured to mount a partition and dump to a file on disk. This is done by specifying the filesystem type, followed

The partition in kdump. conf. The partition may be specified as a device name, a filesystem label, or UUID in the same manner as/etc/fstab.

The default directory in which the core will be dumped is/var/crash/% DATE/where % DATE is the current date at the time of the cash dump. For example:


 
Ext3/dev/sda1
Will mount/dev/sda1 as an ext3 device and dump the core to/var/crash/, whereas

 
Ext3 LABEL =/boot
Will mount the device that is ext3 with the label/boot. on most Red Hat Enterprise Linux installations, this will be the/boot directory. the easiest way to find how to specify the device is to look at what you're currently using in/etc/fstab. the default directory in which the core will be dumped is/var/crash/% DATE/where % DATE is the current date at the time of the crash dump. this can be changed by using the path directive in kdump. conf. for example:


 
Ext3 UUID = f15759be-89d4-46c4-9e1d-1b67e5b5da82
Path/usr/local/cores

Will dump the vmcore to/usr/local/cores/instead of the default/var/crash/location.


Dumping to a Network Device using NFS

To configure kdump to dump to an NFS mount, edit/etc/kdump. conf and add a line with the following format:


 
 
Net :/Nfs/mount
 

For example:


 
 
Net nfs.example.com:/export/vmcores
 

This will dump the vmcore to/export/vmcores/var/crash/[hostname]-[date] on the server nfs.example.com. The client system must have access to write to this mount point.


Dumping to a Network Device using SSH

SSH has the advantage of encrypting network communications while dumping. for this reason this is the best solution when you're required to dump a vmcore into ss a publicly accessible network such as the Internet or a few ate WAN.


 
 
Net user @
 

For example:


 
 
Net kdump@crash.example.com
 

In this case, kdump will use scp to connect to the crash.example.com server using the kdump user. it will copy the vmcore to the/var/crash/[host]-[date]/directory. the kdump user will need the necessary write permissions on the remote server.


To make this change take effect, run service kdump propagate, which shocould result in output similar to the following:


 
 
Generating new ssh keys... done,
Kdump@crash.example.com's password:
/Root/. ssh/kdump_id_rsa.pub has been added
~ Kdump/. ssh/authorized_keys2 on crash.example.com
 

Specifying Page Selection and Compression

On large memory systems, it is advisable to both discard pages that are not needed and to compress remaining pages. this is done in kdump. conf with the core_collector command. at this point in them the only fully supported core collector is makedumpfile. the options can be viewed with makedumpfile -- help. the-d option specifies which types of pages shoshould be left out. the option is a bit mask, having each page type specified like so:

 
Zero pages = 1
Cache pages = 2
Cache private = 4
User pages = 8
Free pages = 16

In general, these pages don't contain relevent information. to set all these flags and leave out these pages, use a value of-d 31. the-c tells makedumpfile to compress the remaining data pages.


 
# Core_collector makedumpfile-d 1 # throw out zero pages (containing no data)
# Core_collector makedumpfile-d 31 # throw out all trival pages
# Core_collector makedumpfile-c # compress all pages, but leave them all
Core_collector makedumpfile-d 31-c # throw out trival pages and compress (recommended)

Keep in mind that using the-d and-c options will marginally increase the ammount of time required to gather a cores.


Adding Boot Parameters

Modify some boot parameters to reserve a chunk of memory for the capture kernel. for i386 and x86_64 ubuntures, edit/etc/grub. conf, and append crashkernel = 128M @ 16 M to the end of the kernel line.
Note: It may be possible to use less than 128 M, but testing with only 64 M has proven unreliable. This is an example of/etc/grub. conf with the kdump options added:

 
 
 
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a/boot partition. This means that
# All kernel and initrd paths are relative to/, eg.
# Root (hd0, 0)
# Kernel/boot/vmlinuz-version ro root =/dev/hda1
# Initrd/boot/initrd-version.img
# Boot =/dev/hda
Default = 0
Timeout = 5
Splashimage = (hd0, 0)/boot/grub/splash.xpm.gz
Hiddenmenu
Title Red Hat Enterprise Linux Client (2.6.17-1.2519.4.21.el5)
Root (hd0, 0)
Kernel/boot/vmlinuz-2.6.17-1.2519.4.21.el5 ro root = LABEL =/rhgb quiet crashkernel = 128M @ 16 M
Initrd/boot/initrd-2.6.17-1.2519.4.21.el5.img
 


Testing

After making the above changes, reboot the system. the 128 M of memory (starting 16 M into the memory) is left untouched by the normal system, reserved for the capture kernel. take note that the output of free-m shows 128 M less memory than without this parameter, which is expected.


Now that the reserved memory region is set up, turn on the kdump init script and start the service:


 
# Chkconfig kdump on
# Service kdump start
 


This shoshould load the kernel image via kexec, leaving the system ready to capture a vmcore upon crashing. To test this, force-crash the system using sysrq:


 
# 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 shocould be copied out to disk to the location you specified in the/etc/kdump. conf file.


NOTE: Console frame-buffers and X are not properly supported. on a system typically run with something like "vga = 791" in the kernel config line or with X running, console video will be garbled when a kernel is booted via kexec. note that the kdump kernel shoshould still be able to create a dump, and when the system reboots, video shoshould be restored to normal.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.