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

Release Found: Red Hat Enterprise Linux 5

Note: for virtualized 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 mechanism 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 essentially 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 previously 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 by

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 across a publicly accessible network such as the Internet or a corporate 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 should 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 to

~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 should 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 architectures, edit /etc/grub.conf, and append crashkernel=128M@16M to the end of the kernel line.

Note: It may be possible to use less than 128M, but testing with only 64M 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@16M

initrd /boot/initrd-2.6.17-1.2519.4.21.el5.img

Testing

After making the above changes, reboot the system. The 128M of memory (starting 16M into the memory) is left untouched by the normal system, reserved for the capture kernel. Take note that the output of free -m shows 128M 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 should load the kernel image 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 should 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 should still be able to create a dump, and when the system reboots, video should be restored to normal.

linux kdump保存的目录,RedHat5之Kdump 非常详细相关推荐

  1. linux kdump保存的目录,linux kdump搭建

    本文将以centos系统为例,说明kdump的配置. 什么是kdump kdump 是一种crash dump捕获机制,用来捕获kernel crash时候产生的crash dump. kdump需要 ...

  2. Linux学习——Linux常用文件和目录管理命令(超详细)

    Linux常用文件和目录管理命令 JunLeon--go big or go home 前言: Linux系统文件和目录管理是必须学会的命令,在Linux系统目录中/tmp目录是用来存放临时文件的目录 ...

  3. linux kdump保存的目录,Linux kdump

    最近有一些老的dell机器总是莫名其妙的系统就没有反应了,查案日志系统却发现什么都没有记录,记录的只是启动后的日志,通过监控系统发现在系统在没有反应前cpu.内存.负载.流量都很正常,就是突然没有响应 ...

  4. linux常见系统目录,Linux系统中常见目录有哪些?linux运维学习中心

    Linux系统中常见目录有哪些?随着开源软件在世界范围内影响力日益增强,Linux服务器操作系统在整个服务器操作系统市场格局中占据了越来越多的市场份额,市场对于Linux运维人才的需求也是逐渐增加.L ...

  5. linux安装手动划分目录,Linux目录配置整理

    FHS: 为了规范各种Linux发行版的目录配置方法和目录定义而制定了FHS规范. 在FHS规范的Linux中,所有的文件和目录都由根目录开始,即"/",它是所有文件和目录的起点. ...

  6. Linux_linux基础命令(增删查,权限,Linux下的重要目录,重要命令(. du, df, top, free, pstack, su, sudo).安装gcc/g++, gdb, vim )

    r:表示可读w:表示可写x:表示可执行也可以用数字表示这一点我们会在修改文件权限说明.对于文件夹的rwx表示:r表示可读及可以查看文件夹内容可以ls查看w表示可写及可以向文件夹中传送内容如文件x表示可 ...

  7. Linux每个用户单独配置ssh,大神全面解读如何限制SSH用户访问Linux中指定的目录...

    将 SSH 用户会话限制访问到特定的目录内,特别是在 web 服务器上,这样做有多个原因,但最显而易见的是为了系统安全.为了锁定 SSH 用户在某个目录,我们可以使用 chroot 机制. 在诸如 L ...

  8. linux root所在目录,Linux下误删root目录

    Linux下误删root目录 发布时间:2008-05-26 01:09:21来源:红联作者:Baidoa 下午用vi编辑文件,保存退出时误按~键,按成wq~,结果目录下产生一个名为~的文件.因为以前 ...

  9. Linux下PhpMyAdmin程序目录的安全管理

    Linux下PhpMyAdmin程序目录的安全管理 Linux下开发Web程序,现在很流行的开发方法为:用PHP开发Web程序,用Apache做Web Server,Mysql充当后台管理数据库.这种 ...

最新文章

  1. 全民捡破烂,转转和闲鱼谁能胜出?
  2. grub 引导 多linux系统,GRUB 多系统引导
  3. Java BigDecimal类的使用入门示例
  4. JavaScript进阶4-学习笔记
  5. Angular应用里使用rxjs提供的观察者和发布者实现事件处理
  6. Mysql学习笔记(二):子查询与连接
  7. 【转载保存】Ubuntu14.04安装pycharm用于Python开发环境部署,并且支持pycharm使用中文输入
  8. (转)GB2312简体中文编码表
  9. 基于imx6ul下调试tlv320aic3x声卡
  10. 重装系统蓝屏,电脑开机蓝屏解决方法记录
  11. 文件操作fwrite写txt文件乱码怎么办,我这里有方法解决
  12. kubeadm安装的k8s集群证书有效期过期解决方案
  13. word里文字竖向排列(设置竖排文字)
  14. 单片机原理与应用-51
  15. 什么是checkpoint (转)
  16. 用 Python 爬了点你们喜欢的电影,这些电影真的很不错
  17. Spring Boot 和 Spring 有什么区别
  18. docker命令无响应,进入不了容器问题解决
  19. 二、(3)doc2vec
  20. Android:设置头像

热门文章

  1. Vue引入fastclick
  2. IOS低版本无法显示渐变色文字问题,iso不兼容渐变色文字问题
  3. 干货分享 | 采购没“云”和有云的区别有哪些?
  4. 传奇服务端结构传奇服务端结构
  5. m2server架构
  6. 递归算法,读这篇文章或许更有启发
  7. 自定义类加载器以及打破双亲委派
  8. Google earth engine(GEE)之代码优化问题
  9. 【设计模式】备忘录模式(Memento Pattern)
  10. 华为余承东给新员工的讲话