当我获得红帽企业版Linux 3或者4系统OOPS或者kernel panic时,怎样将coredump(vmcore)保存到硬盘上?
解决方法:

diskdump工具和netdump工具一样,可以扑捉系统输出信息,但是不需要网络和其他的服务器支持。目前只支持i386和x84_64架构,其他的硬件支持正在添加中。

执行下面命令以获得最新的升级包:

# up2date diskdumputils

请阅读相关文档:/usr/share/doc/diskdumputils-/README, 内容如下:

Overview
--------
The diskdumputils package is installed on the machine that enables
disk dump. It loads and configures the diskdump modules so that
if the machine crashes, the memory dump will be dumped to disk.

Supported Drivers
------------------
Disk dump only works on the disks which are connected to
adapters that the following drivers control:

        RHEL3                   RHEL4
        ---------------------------------
        aic7xxx                 aic7xxx
        aic79xx                 aic79xx
        dpt_i2o
                                ipr
        megaraid2               megaraid
        mptfusion               mptfusion
        sym53c8xx               sym53c8xx
        sata_promise            sata_promise
        ata_piix                ata_piix

Supported Kernels
------------------
Disk dump is supported in the following Red Hat kernels,
where  is the version containing this
diskdumputils package:

        RHEL3     (Note: RHEL3 requires Update 3 or higher)
                kernel-.i686.rpm
                kernel-smp-.i686.rpm
                kernel-hugemem-.i686.rpm
                kernel-.athlon.rpm
                kernel-smp-.athlon.rpm
                kernel-.ia64.rpm
                kernel-.x86-64.rpm
                kernel-smp-.x86-64.rpm
                kernel-smp-.ia32e.rpm
        RHEL4
                kernel-.i686.rpm
                kernel-smp-.i686.rpm
                kernel-hugemem-.i686.rpm
                kernel-.ia64.rpm
                kernel-.ppc64.rpm
                kernel-.x86-64.rpm
                kernel-smp-.x86-64.rpm

Setup
------------
The setup procedure is as follows.  First a dump device must be
selected.  Either a whole device or a partition is fine.  The dump
device is wholly formatted for dump, and cannot be shared with a file
system or as a swap partition.  The size of dump device should be
big enough to save the whole dump.  The dump size to be written
consists of the size of whole memory plus a header field.  To
determine the exact size required, refer to the output of
/proc/diskdump after the diskdump module is loaded:

  # modprobe diskdump

  # cat /proc/diskdump

  # sample_rate: 8
  # block_order: 2
  # fallback_on_err: 1
  # allow_risky_dumps: 1
  # total_blocks: 262042
  #

The total block size is expressed in page-size units, so in this
example, the selected device must contain at least (262042 * 4096) bytes
on an i386 machine.


Select the dump partition in /etc/sysconfig/diskdump, as in the
following example:

  -------------------
  DEVICE=/dev/sde1
  -------------------

Multiple dump partitions can be specified as a colon-separated list.
Each partition should be large enough to contain whole dump, even if
multiple partitions are specified.


接下来,格式化dump分区。以管理员身份执行命令:

# service diskdump initialformat

启动服务:

# chkconfig diskdump on
# service diskdump start

如果/proc/diskdump存在,并且内容里包含已经注册的dump设备,说明diskdump已经被激活

# cat /proc/diskdump
/dev/sde1 514080 1012095
Testing diskdump
---------------
To test the diskdump, use Alt-SysRq-C or "echo c > /proc/sysrq-trigger".
After completing the dump, a vmcore file will be created during the next
reboot sequence, and saved in a directory of the name format:

  /var/crash/127.0.0.1-<date>

The vmcore file's format is same as that created by the netdump
facility, so you can use the crash command to analyze it

Note
----
Once you set up, it is not necessary to do anything after that.
But you should always maintain enough diskspace in /var/crash.
If there is not enough space, the dump file will be partially saved;
an incomplete dump file will be named vmcore-incomplete.

Diskdump currently contains one customizable script file called
diskdump-nospace.  The diskdump-nospace script is called prior
to the creation of the vmcore file if /var/crash does not have
enough space to hold the complete dumpfile.  The script may be
customized to clean up enough space for the dump in question
to proceed.

Tunable parameters
----
The diskdump module has following module parameters:

block_order:    Specifies the dump-time I/O block size. Default value is 2,
                which sets the I/O block size equal to "page-size << 2", or
                16 kbytes on an i386 machine. Larger values may make for
                better performance, but occupies more module memory.

sample_rate:    Determine how many blocks in the dump partition are verified
                before actual memory dumping begins. Default value is 8,
                which means one of every "1<<8" (256) blocks are verified.
                Specifying zero means all blocks in the partition are verified,
                and a minus value disables verification.

Example:

The following option sets I/O block size to 32 kbytes, and verification is
done on every block in the partition.

        options diskdump 'block_order=3' 'sample_rate=0'