<chapter id="tscrashdumps-40145"><title>Managing System
Crash Information (Tasks)</title><highlights><para>This chapter describes how to manage system crash information in the Solaris Operating System.</para><para>For information on the procedures associated with managing system crash
information, see <olink targetptr="tscrashdumps-26694" remap="internal">Managing System Crash
Information (Task Map)</olink>.</para>
</highlights><sect1 id="tscrashdumps-26694"><title>Managing System Crash Information (Task
Map)</title><para>The following task map identifies the procedures needed to manage system
crash information.</para><informaltable frame="all"><tgroup cols="3" colsep="1" rowsep="1"><colspec colwidth="110*"/><colspec colname="col2" colwidth="167*"/><colspec colwidth="119*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>1. Display the current crash dump configuration.</para>
</entry><entry><para>Display the current crash dump configuration by using the <command>dumpadm</command> command.</para>
</entry><entry><para><olink targetptr="tscrashdumps-35" remap="internal">How to Display the Current Crash
Dump Configuration</olink></para>
</entry>
</row><row><entry><para>2. Modify the crash dump configuration.</para>
</entry><entry><para>Use the <command>dumpadm</command> command to specify the type of data
to dump, whether or not the system will use a dedicated dump device, the directory
for saving crash dump files, and the amount of space that must remain available
after crash dump files are written.</para>
</entry><entry><para><olink targetptr="tscrashdumps-37" remap="internal">How to Modify a Crash Dump Configuration</olink></para>
</entry>
</row><row><entry><para>3. Examine a crash dump file.</para>
</entry><entry><para>Use the <command>mdb</command> command to view crash dump files.</para>
</entry><entry><para><olink targetptr="tscrashdumps-58578" remap="internal">How to Examine a Crash Dump</olink></para>
</entry>
</row><row><entry><para>4. (Optional) Recover from a full crash dump directory.</para>
</entry><entry><para>The system crashes, but no room is available in the <command>savecore</command> directory,
and you want to save some critical system crash dump information.</para>
</entry><entry><para><olink targetptr="tscrashdumps-34" remap="internal">How to Recover From a Full Crash
Dump Directory (Optional)</olink></para>
</entry>
</row><row><entry><para>5. (Optional) Disable or enable the saving of crash dump files.</para>
</entry><entry><para>Use the <command>dumpadm</command> command to disable or enable the
saving the crash dump files. Saving crash dump files is enabled by default.</para>
</entry><entry><para><olink targetptr="tscrashdumps-39" remap="internal">How to Disable or Enable Saving Crash
Dumps</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1><sect1 id="tscrashdumps-4"><title>System Crashes (Overview)</title><para>System crashes can occur due to hardware malfunctions, I/O problems,
and software errors. If the system crashes, it will display an error message
on the console, and then write a copy of its physical memory to the dump device.
The system will then reboot automatically. When the system reboots, the <command>savecore</command> command is executed to retrieve the data from the dump
device and write the saved crash dump to your <command>savecore</command> directory.
The saved crash dump files provide invaluable information to your support
provider to aid in diagnosing the problem.</para><sect2><title>ZFS Support
for Swap Devices</title><para>If you select a ZFS root file system during an initial installation
or use live upgrade to migrate from a UFS root file system to a ZFS root file
system, a swap area is created on a ZFS volume in the ZFS root pool. The swap
area size is based on 1/4 to 1/2 of physical memory.</para><para>For example:</para><screen># swap -l
swapfile                  dev    swaplo   blocks     free
/dev/zvol/dsk/rpool/swap 253,3        16  8257520  8257520</screen><para>A ZFS volume is also created for the dump device. Currently, the swap
area and the dump device must reside on separate ZFS volumes.</para><para>If you need to modify your ZFS swap area after installation, then use
the swap command as in previous Solaris releases. For more information, see <olink targetdoc="group-sa" targetptr="fsswap-14677" remap="external">Chapter 21, <citetitle remap="chapter">Configuring Additional Swap Space (Tasks),</citetitle> in <citetitle remap="book">System Administration Guide: Devices and File Systems</citetitle></olink>.</para><para>For information about managing dump devices, see <olink targetptr="tscrashdumps-31" remap="internal">Managing System Crash Dump Information</olink>.</para>
</sect2><sect2 id="fxcly" arch="x86"><title>System Crashes in the GRUB Boot Environment</title><para> If a system crash occurs on an x86 based system in the GRUB boot
environment, it is possible that the SMF service that manages the GRUB boot
archive, <filename>svc:/system/boot-archive:default,</filename> might fail
on the next system reboot. To troubleshoot this type of problem, see <olink targetptr="fxcmh" remap="internal">What to Do if the SMF Boot Archive Service Fails During
a System Reboot</olink>. For more information on GRUB based booting, see <olink targetdoc="group-sa" targetptr="hbx86boot-68676" remap="external"><citetitle remap="section">Booting an x86 Based System by Using GRUB (Task Map)</citetitle> in <citetitle remap="book">System Administration Guide: Basic Administration</citetitle></olink>.</para>
</sect2><sect2 id="tscrashdumps-1"><title>System Crash Dump Files</title><para>The <command>savecore</command> command runs automatically after a system
crash to retrieve the crash dump information from the dump device and writes
a pair of files called <filename>unix</filename>.<replaceable>X</replaceable> and <filename>vmcore</filename>.<replaceable>X</replaceable>, where <replaceable>X</replaceable> identifies
the dump sequence number. Together, these files represent the saved system
crash dump information. </para><para>Crash dump files are sometimes confused with <emphasis>core</emphasis> files,
which are images of user applications that are written when the application
terminates abnormally.</para><para>Crash dump
files are saved in a predetermined directory, which by default, is <filename>/var/crash/</filename><replaceable>hostname</replaceable>. In previous Solaris releases,
crash dump files were overwritten when a system rebooted, unless you manually
enabled the system to save the images of physical memory in a crash dump file.
Now, the saving of crash dump files is enabled by default. </para><para>System crash information is managed with the <command>dumpadm</command> command.
For more information, see <olink targetptr="tscrashdumps-32" remap="internal">The dumpadm Command</olink>.</para>
</sect2><sect2 id="tscrashdumps-25"><title>Saving Crash Dumps</title><para>You can examine the control structures, active tables, memory images
of a live or crashed system kernel, and other information about the operation
of the kernel by using the <command>mdb</command> utility. Using <command>mdb</command> to
its full potential requires a detailed knowledge of the kernel, and is beyond
the scope of this manual. For information on using this utility, see the <olink targetdoc="refman" targetptr="mdb-1" remap="external"><citerefentry><refentrytitle>mdb</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> man page.</para><para>Additionally, crash dumps saved by <command>savecore</command> can
be useful to send to a customer service representative for analysis of why
the system is crashing. </para>
</sect2><sect2 id="tscrashdumps-32"><title>The <command>dumpadm</command> Command</title><itemizedlist><para>Use the <command>dumpadm</command> command to manage system crash dump
information in the Solaris Operating System.</para><listitem><para>The <command>dumpadm</command> command enables you to configure
crash dumps of the operating system. The <command>dumpadm</command> configuration
parameters include the dump content, dump device, and the directory in which
crash dump files are saved.</para>
</listitem><listitem><para>Dump data is stored in compressed format on the dump device.
Kernel crash dump images can be as big as 4 Gbytes or more. Compressing the
data means faster dumping and less disk space needed for the dump device.</para>
</listitem><listitem><para>Saving crash dump files is run in the background when a dedicated
dump device, not the swap area, is part of the dump configuration. This means
a booting system does not wait for the <command>savecore</command> command
to complete before going to the next step. On large memory systems, the system
can be available before <command>savecore</command> completes.</para>
</listitem><listitem><para>System crash dump files, generated by the <command>savecore</command> command,
are saved by default.</para>
</listitem><listitem><para>The <command>savecore -L</command> command is a new feature
which enables you to get a crash dump of the live running the Solaris OS.
This command is intended for troubleshooting a running system by taking a
snapshot of memory during some bad state, such as a transient performance
problem or service outage. If the system is up and you can still run some
commands, you can execute the <command>savecore -L</command> command to save
a snapshot of the system to the dump device, and then immediately write out
the crash dump files to your <command>savecore</command> directory. Because
the system is still running, you can only use the <command>savecore -L</command> command
if you have configured a dedicated dump device.</para>
</listitem>
</itemizedlist><para>The following table
describes <command>dumpadm</command>'s configuration parameters.</para><informaltable frame="all"><tgroup cols="2" colsep="1" rowsep="1"><colspec colwidth="118*"/><colspec colwidth="278*"/><thead><row><entry><para>Dump Parameter</para>
</entry><entry><para>Description</para>
</entry>
</row>
</thead><tbody><row><entry><para>dump device</para>
</entry><entry><para>The device that stores dump data temporarily as the system crashes.
When the dump device is not the swap area, <command>savecore</command> runs
in the background, which speeds up the boot process.</para>
</entry>
</row><row><entry><para>savecore directory</para>
</entry><entry><para>The directory that stores system crash dump files.</para>
</entry>
</row><row><entry><para>dump content</para>
</entry><entry><para>Type of memory data to dump. </para>
</entry>
</row><row><entry><para>minimum free space</para>
</entry><entry><para>Minimum amount of free space required in the <command>savecore</command> directory
after saving crash dump files.  If no minimum free space has been configured,
the default is one Mbyte.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable><para>For more information, see <olink targetdoc="refman" targetptr="dumpadm-1m" remap="external"><citerefentry><refentrytitle>dumpadm</refentrytitle><manvolnum>1M</manvolnum></citerefentry></olink>.</para><para>Dump configuration parameters are managed by the <command>dumpadm</command> command.</para>
</sect2><sect2 id="tscrashdumps-33"><title>How the <command>dumpadm</command> Command
Works</title><para>During system startup, the <command>dumpadm</command> command is invoked
by the <filename>svc:/system/dumpadm:default</filename> service to configure
crash dumps parameters.</para><para>Specifically, <command>dumpadm</command> initializes the dump device
and the dump content through the <filename>/dev/dump</filename> interface.</para><para>After the dump configuration is complete, the <filename>savecore</filename> script
looks for the location of the crash dump file directory. Then, <filename>savecore</filename> is invoked to check for crash dumps and check the content of the <filename>minfree</filename> file in the crash dump directory. </para>
</sect2><sect2 id="tscrashdumps-5"><title>Dump Devices and Volume Managers</title><para>Do not configure a dedicated dump device that is under the control of
volume management product such as Solaris Volume Manager for accessibility
and performance reasons. You can keep your swap areas under the control of
Solaris Volume Manager and this is a recommend practice, but keep your dump
device separate.</para>
</sect2>
</sect1><sect1 id="tscrashdumps-31"><title>Managing System Crash Dump Information</title><itemizedlist><para>Keep the following key points in mind when you are working with system
crash information:</para><listitem><para>You must be superuser or assume an equivalent role to access
and manage system crash information.</para>
</listitem><listitem><para>Do not disable the option of saving system crash dumps. System
crash dump files provide an invaluable way to determine what is causing the
system to crash.</para>
</listitem><listitem><para>Do not remove important system crash information until it
has been sent to your customer service representative.</para>
</listitem>
</itemizedlist><task id="tscrashdumps-35"><title>How to Display the Current Crash Dump Configuration</title><procedure>&rolestep.sgm;<step id="tscrashdumps-step-40"><para>Display the current crash dump configuration.</para><screen># <userinput>dumpadm</userinput>
Dump content: kernel pages
Dump device: /dev/dsk/c0t3d0s1 (swap)
Savecore directory: /var/crash/venus
Savecore enabled: yes</screen><itemizedlist><para>The preceding example output means:</para><listitem><para>The dump content is kernel memory pages.</para>
</listitem><listitem><para>Kernel memory will be dumped on a swap device, <filename>/dev/dsk/c0t3d0s1</filename>. You can identify all your swap areas with the <command>swap -l</command> command.</para>
</listitem><listitem><para>System crash dump files will be written in the <filename>/var/crash/venus</filename> directory.</para>
</listitem><listitem><para>Saving crash dump files is enabled.</para>
</listitem>
</itemizedlist>
</step>
</procedure>
</task><task id="tscrashdumps-37"><title>How to Modify a Crash Dump Configuration</title><procedure>&rolestep.sgm;<step id="tscrashdumps-step-43"><para>Identify the current crash dump configuration.</para><screen># <userinput>dumpadm</userinput>
      Dump content: kernel pages
       Dump device: /dev/dsk/c0t3d0s1 (swap)
Savecore directory: /var/crash/pluto
  Savecore enabled: yes</screen><para>This output identifies the default dump configuration for a system running
the Solaris 10 release.</para>
</step><step id="tscrashdumps-step-44"><para>Modify the crash dump configuration.</para><screen># <userinput>dumpadm -c</userinput> <replaceable>content</replaceable> <userinput>-d</userinput> <replaceable>dump-device</replaceable> <userinput>-m</userinput> <replaceable>nnnk | nnnm | nnn%</replaceable> <userinput>-n</userinput> <userinput>-s</userinput> <replaceable>savecore-dir</replaceable></screen><variablelist><varlistentry><term><option>c</option> <replaceable>content</replaceable></term><listitem><para>Specifies the type of data to dump. Use <literal>kernel</literal> to
dump of all kernel memory, <literal>all</literal> to dump all of memory, or <literal>curproc</literal>, to dump kernel memory and the memory pages of the process
whose thread was executing when the crash occurred. The default dump content
is kernel memory.</para>
</listitem>
</varlistentry><varlistentry><term><option>d</option> <replaceable>dump-device</replaceable></term><listitem><para>Specifies the device that stores dump data temporarily as
the system crashes. The primary swap device is the default dump device. </para>
</listitem>
</varlistentry><varlistentry><term><option>m</option> <replaceable>nnnk</replaceable> | <replaceable>nnnm</replaceable> | <replaceable>nnn%</replaceable></term><listitem><para>Specifies the minimum free disk space for saving crash dump
files by creating a <filename>minfree</filename> file in the current <filename>savecore</filename> directory. This parameter can be specified in Kbytes (<literal>nnnk</literal>),
Mbytes (<literal>nnnm</literal>) or file system size percentage (<literal>nnn%</literal>).
The <command>savecore</command> command consults this file prior to writing
the crash dump files. If writing the crash dump files, based on their size,
would decrease the amount of free space below the <filename>minfree</filename> threshold,
the dump files are not written and an error message is logged.  For information
on recovering from this scenario, see <olink targetptr="tscrashdumps-34" remap="internal">How
to Recover From a Full Crash Dump Directory (Optional)</olink>.</para>
</listitem>
</varlistentry><varlistentry><term><option>n</option></term><listitem><para>Specifies that <command>savecore</command> should not be run
when the system reboots. This dump configuration is not recommended. If system
crash information is written to the swap device, and <command>savecore</command> is
not enabled, the crash dump information is overwritten when the system begins
to swap.</para>
</listitem>
</varlistentry><varlistentry><term><option>s</option></term><listitem><para>Specifies an alternate directory for storing crash dump files.
The default directory is <filename>/var/crash/hostname</filename> where <literal>hostname</literal> is the output of the <command>uname -n</command> command.</para>
</listitem>
</varlistentry>
</variablelist>
</step>
</procedure><example id="emjeg"><title>Modifying a Crash Dump Configuration</title><para>In this example, all of memory is dumped to the dedicated dump device, <filename>/dev/dsk/c0t1d0s1</filename>, and the minimum free space that must be available
after the crash dump files are saved is 10% of the file system space.</para><screen># <userinput>dumpadm</userinput>
      Dump content: kernel pages
       Dump device: /dev/dsk/c0t3d0s1 (swap)
Savecore directory: /var/crash/pluto
  Savecore enabled: yes
 # <userinput>dumpadm -c all -d /dev/dsk/c0t1d0s1 -m 10%</userinput>
      Dump content: all pages
       Dump device: /dev/dsk/c0t1d0s1 (dedicated)
Savecore directory: /var/crash/pluto (minfree = 77071KB)
  Savecore enabled: yes</screen>
</example>
</task><task id="tscrashdumps-58578"><title>How to Examine a Crash Dump</title><procedure>&rolestep.sgm;<step id="tscrashdumps-step-30"><para>Examine a crash dump by using the <command>mdb</command> utility.
   </para><screen># <userinput>/usr/bin/mdb</userinput> [<userinput>-k</userinput>] <replaceable>crashdump-file</replaceable></screen><variablelist><varlistentry><term><option>k</option></term><listitem><para>Specifies kernel debugging mode by assuming the file is an
operating system crash dump file.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>crashdump-file</replaceable></term><listitem><para>Specifies the operating system crash dump file.</para>
</listitem>
</varlistentry>
</variablelist>
</step><step id="tscrashdumps-step-31"><para>Display crash status information.</para><screen># <userinput>/usr/bin/mdb</userinput> <replaceable>file-name</replaceable>
> <userinput>::status</userinput>
   .
   .
   .
> <userinput>::system</userinput>
   .
   .
   .</screen>
</step>
</procedure><example id="emjee"><title>Examining a Crash Dump</title><para>The following
example shows sample output from the <command>mdb</command> utility, which
includes system information and identifies the tunables that are set in this
system's <filename>/etc/system</filename> file.   </para><screen># <userinput>/usr/bin/mdb -k unix.0</userinput> 
Loading modules: [ unix krtld genunix ip nfs ipc ptm ]
> <userinput>::status</userinput>
debugging crash dump /dev/mem (64-bit) from ozlo
operating system: 5.10 Generic (sun4u)
> <userinput>::system</userinput>
set ufs_ninode=0x9c40 [0t40000]
set ncsize=0x4e20 [0t20000]
set pt_cnt=0x400 [0t1024]</screen>
</example>
</task><task id="tscrashdumps-34"><title>How to Recover From a Full Crash Dump Directory
(Optional)</title><tasksummary><para>In this scenario, the system crashes but no room is left in the <command>savecore</command> directory, and you want to save some critical system crash dump
information.  </para>
</tasksummary><procedure><step id="tscrashdumps-step-45"><para>Log in as superuser or assume an equivalent
role after the system reboots.</para>
</step><step id="tscrashdumps-step-36"><para>Clear out the savecore directory, usually <filename>/var/crash/</filename><replaceable>hostname</replaceable>, by removing existing
crash dump files that have already been sent to your service provider. Or,
run the <command>savecore</command> command and specify an alternate directory
that has sufficient disk space. See the next step.</para>
</step><step id="tscrashdumps-step-37"><para>Manually run the <command>savecore</command> command
and if necessary, specify an alternate savecore directory.</para><screen># <userinput>savecore</userinput> [ <replaceable>directory</replaceable> ]</screen>
</step>
</procedure>
</task><task id="tscrashdumps-39"><title>How to Disable or Enable Saving Crash Dumps</title><procedure>&rolestep.sgm;<step id="tscrashdumps-step-33"><para>Disable or enable the saving of crash
dumps on your system. </para><screen># <userinput>dumpadm -n | -y</userinput></screen>
</step>
</procedure><example id="emjef"><title>Disabling the Saving of Crash Dumps</title><para>This example illustrates how to disable the saving of crash dumps on
your system.</para><screen># <userinput>dumpadm -n</userinput>
      Dump content: all pages
       Dump device: /dev/dsk/c0t1d0s1 (dedicated)
Savecore directory: /var/crash/pluto (minfree = 77071KB)
  Savecore enabled: no</screen>
</example><example id="emjdz"><title>Enabling the Saving of Crash Dumps</title><para>This example illustrates how to enable the saving of crash dump on your
system.</para><screen># <userinput>dumpadm -y</userinput>
      Dump content: all pages
       Dump device: /dev/dsk/c0t1d0s1 (dedicated)
Savecore directory: /var/crash/pluto (minfree = 77071KB)
  Savecore enabled: yes</screen>
</example>
</task>
</sect1>
</chapter>