Creating a Core Dump

Table of Contents

Creating a Core Dump
Using exception Commands
Using the write core Command

Creating a Core Dump


If the switch router fails, it is sometimes useful to get a full copy of the memory image, called a core dump, to identify the cause of the failure. Core dumps are generally only useful to your technical support representative.


Caution   Use the commands discussed in this appendix only under the direction of a technical support representative. Creating a core dump while the switch router is functioning in a network can disrupt network operation. The resulting binary file, which is very large, must be transferred to a Trivial File Transfer Protocol (TFTP), File Transfer Protocol (FTP), or remote copy (rcp) server. It is subsequently interpreted by technical personnel who have access to source code and detailed memory maps.

Using exception Commands

Use the exception class of configuration commands only after consulting with a technical support representative. These commands are useful for debugging purposes, but they can result in unexpected behavior.

Creating a Core Dump

To obtain a core dump when a switch router fails, use the exception dump ip-address switch router configuration command (where ip-address is the address of your TFTP server).

If you include this command in your configuration, the switch router attempts a core dump when it crashes. The core dump is written to a file named hostname-core on your server, where hostname is the name of the switch router. You can change the name of the core file by entering the exception core-file filename command.

The default protocol for transferring the core dump is TFTP. However, TFTP transfers only 16 MB of the core dump file. If the switch router memory is over 16 MB, only the first 16 MB is transferred. To transfer the whole core dump, configure the switch router to use rcp or FTP for core dumps with the exception protocol command.

The following example configures a switch router to use rcp to dump the core file when it crashes:

Switch# configure terminal
Switch (config)# ip rcmd remote-username red
Switch (config)# exception protocol rcp
Switch (config)# exception dump 172.17.92.2

The following example configures a switch router to use FTP to dump the core file when it crashes:

Switch# configure terminal
Switch (config)# ip ftp username red
Switch (config)# ip ftp password blue
Switch (config)# exception protocol ftp
Switch (config)# exception dump 172.17.92.2

Note   The remote machine must be configured to allow the switch router to write to it. For example, if you are using rcp with a UNIX system, the .rhosts file for the remote user must contain an entry for the switch router. Refer to the documentation for your FTP or rcp server for details.

This procedure can fail for certain types of system crashes. However, if successful, the core dump file will be the size of the memory available on the processor.

Creating an Exception Memory Core Dump

During the debugging process, you can cause the switch router to create a core dump and reboot when certain memory size parameters are violated. The exception memory commands define a minimum contiguous block of memory in the free pool and a minimum size for the free memory pool.

[no] exception memory fragment size
[no] exception memory minimum size

The value of size is in bytes and is checked every 60 seconds. If you enter a size that is greater than the free memory and the exception dump command has been configured, the switch router creates a core dump and reloads the Cisco IOS software after 60 seconds. If the exception dump command is not configured, the switch router reloads without generating a core dump.

The following example configures the switch router to monitor the free memory. If the free memory falls below 250,000 bytes, the switch router dumps the core and reloads.

Switch# configure terminal
Switch (config)# exception dump 131.108.92.2
Switch (config)# exception core-file memory.overrun
Switch (config)# exception memory minimum 250000

Using the write core Command

You can create test core dumps by using the write core privileged EXEC command. If you use this command, the switch router generates a core dump without reloading, which is useful if the switch router is malfunctioning but has not crashed.


Caution   Use the write core command only under the direction of a technical support representative. Creating a core dump while the switch router is functioning in a network can disrupt network operation. The resulting binary file, which is very large, must be transferred to a TFTP, FTP, or rcp server and subsequently interpreted by technical personnel who have access to source code and detailed memory maps.

Depending on your TFTP server, you might need to create an empty target file to which the switch router can write the core dump.