With kdump, the memory image of the first kernel (called "panicked kernel") can be taken as /proc/vmcore while the second kernel (called "kdump kernel" or "capture kernel") is running. This document represents /proc/vmcore as VMCORE. makedumpfile makes a small DUMPFILE by compressing dump data or by excluding unnecessary pages for analysis, or both. makedumpfile needs the first kernel's debug information, so that it can distinguish unnecessary pages by analyzing how the first kernel uses the memory. The information can be taken from VMLINUX or VMCOREINFO.
makedumpfile can exclude the following types of pages while copying
VMCORE to DUMPFILE, and a user can choose which type of pages will
be excluded.
- Pages filled with zero
- Cache pages
- User process data pages
- Free pages
makedumpfile provides two DUMPFILE formats (the ELF format and the kdump-compressed format). By default, makedumpfile makes a DUMPFILE in the kdump-compressed format. The kdump-compressed format is readable only with the crash utility, and it can be smaller than the ELF format because of the compression support. The ELF format is readable with GDB and the crash utility. If a user wants to use GDB, DUMPFILE format has to be explicitly specified to be the ELF format.
To analyze the first kernel's memory usage, makedumpfile can refer to
VMCOREINFO instead of VMLINUX. VMCOREINFO contains the first
kernel's information (structure size, field offset, etc.), and VMCOREINFO
is small enough to be included into the second kernel's initrd.
If the second kernel is running on its initrd without mounting a root file
system, makedumpfile cannot refer to VMLINUX because the second kernel's
initrd cannot include a large file like VMLINUX. To solve the problem,
makedumpfile makes VMCOREINFO beforehand, and it refers to
VMCOREINFO instead of VMLINUX while the second kernel is running.
VMCORE has contained VMCOREINFO since linux-2.6.24, and a user does
not need to specify neither -x nor -i option.
If the second kernel is running on its initrd without mounting any file system, a user needs to transport the dump data to a remote host. To transport the dump data by SSH, makedumpfile outputs the dump data in the intermediate format (the flattened format) to the standard output. By piping the output data to SSH, a user can transport the dump data to a remote host. Note that analysis tools cannot read the flattened format directly, so on a remote host the received data in the flattened format needs to be rearranged to a readable DUMPFILE format by makedumpfile (or makedumpfile-R.pl).
makedumpfile can read a DUMPFILE in the kdump-compressed format instead
of VMCORE and re-filter it. This feature is useful in situation that
users need to reduce the file size of DUMPFILE for sending it somewhere
by ftp/scp/etc. (If all of the page types, which are specified by a new dump_level,
are excluded from an original DUMPFILE already, a new DUMPFILE is the
same as an original DUMPFILE.)
For example, makedumpfile can create a DUMPFILE of dump_level 31 from the
one of dump_level 3 like the following:
Example:
# makedumpfile -c -d 3 /proc/vmcore dumpfile.1
# makedumpfile -c -d 31 dumpfile.1 dumpfile.2
dump | zero | cache|cache | user | free
level | page | page |private| data | page
-------+------+------+-------+------+------
0 | | | | |
1 | X | | | |
2 | | X | | |
3 | X | X | | |
4 | | X | X | |
5 | X | X | X | |
6 | | X | X | |
7 | X | X | X | |
8 | | | | X |
9 | X | | | X |
10 | | X | | X |
11 | X | X | | X |
12 | | X | X | X |
13 | X | X | X | X |
14 | | X | X | X |
15 | X | X | X | X |
16 | | | | | X
17 | X | | | | X
18 | | X | | | X
19 | X | X | | | X
20 | | X | X | | X
21 | X | X | X | | X
22 | | X | X | | X
23 | X | X | X | | X
24 | | | | X | X
25 | X | | | X | X
26 | | X | | X | X
27 | X | X | | X | X
28 | | X | X | X | X
29 | X | X | X | X | X
30 | | X | X | X | X
31 | X | X | X | X | X
Instead of using -R option, a perl script "makedumpfile-R.pl" rearranges the
dump data in the flattened format to a normal DUMPFILE, too. The perl
script does not depend on architecture, and most systems have perl command.
Even if a remote host does not have makedumpfile, it is possible to rearrange
the dump data in the flattened format to a readable DUMPFILE on a remote
host by running this script.
Example:
# makedumpfile -F -d 31 -x vmlinux /proc/vmcore \
| ssh user@host "makedumpfile-R.pl dumpfile"
Example:
# makedumpfile -E -X --xen_phys_start 0xcee00000 /proc/vmcore dumpfile
message | progress | common | error | debug | report
level | indicator| message | message | message | message
---------+----------+---------+---------+---------+---------
0 | | | | |
1 | X | | | |
2 | | X | | |
3 | X | X | | |
4 | | | X | |
5 | X | | X | |
6 | | X | X | |
* 7 | X | X | X | |
8 | | | | X |
9 | X | | | X |
10 | | X | | X |
11 | X | X | | X |
12 | | | X | X |
13 | X | | X | X |
14 | | X | X | X |
15 | X | X | X | X |
16 | | | | | X
17 | X | | | | X
18 | | X | | | X
19 | X | X | | | X
20 | | | X | | X
21 | X | | X | | X
22 | | X | X | | X
23 | X | X | X | | X
24 | | | | X | X
25 | X | | | X | X
26 | | X | | X | X
27 | X | X | | X | X
28 | | | X | X | X
29 | X | | X | X | X
30 | | X | X | X | X
31 | X | X | X | X | X
Example:
# makedumpfile --dump-dmesg /proc/vmcore dmesgfile
# makedumpfile --dump-dmesg -x vmlinux /proc/vmcore dmesgfile
Written by Masaki Tachibana, and Ken'ichi Ohmichi.