savecrash - save a crash dump of the operating system
dumpdevice offset] sysfile] minfree] chunksize] tapedevice] [dirname]
saves the crash dump information of the system (assuming one was made when the system crashed) and writes a reboot message in the shutdown
dirname is the name of the existing directory in which to store the crash dump; the default is
saves the crash image and related files in the directory The trailing n in the directory name is a number that increases by one every time
is run with the same dirname. This number is kept in the file which is created if it does not already exist.
Usually, creates the file in the crash directory from the crash dump header, copies all kernel modules that were loaded in memory at the
time of the crash, and copies all dump device contents into crash image files.
When writes out a crash dump directory, it checks the space available on the file system containing dirname. will not use that portion of
the file system space which is reserved for the superuser. Additional space on the file system can be reserved for other uses with min-
free, where minfree is the amount of additional space to reserve. This option is useful for ensuring enough file system space for normal
system activities after a panic.
If there is insufficient space in the file system for the portions of the crash dump that need to be saved, will save as much as will fit
in the available space. (Priority is given to the index file, then to the kernel module files, and then to the physical memory image.)
The dump will be considered saved, and will not attempt to save it again, unless there was insufficient space for any of the physical mem-
ory image. (See the description of option
also writes a reboot message in the shutdown log file if one exists. (If a shutdown log file does not exist, does not create one.) If the
system crashes as a result of a kernel panic, also records the panic string in the shutdown log.
By default, when the primary paging device is not used as one of the dump devices or after the crash image on the primary paging device has
been saved, runs in the background. This reduces system boot-up time by allowing the system to be run with only the primary paging device.
It is possible for dump devices to be used also as paging devices. If determines that a dump device is already enabled for paging, and
that paging activity has already taken place on that device, a warning message will indicate that the dump may be invalid. If a dump
device has not already been enabled for paging, prevents paging from being enabled to the device by creating the file does not enable the
device for paging if the device is locked in (see swapon(1M) for more details). As finishes saving the image from each dump device, it
updates the file and optionally executes to enable paging on the device.
Options and Operands
The command recognizes the following options and operands.
dirname The name of the existing directory in which to store the crash dump; the default is
Mark the dump in the dump device as saved, without performing any other
action. The option is useful for manually inhibiting dump actions called by
Run in the foreground only. By default, runs in the background when the primary paging device does not contain an unsaved portion of
the crash image. Turning this option on increases system boot-up time, but guarantees that the dump has been saved when control
returns to the caller.
Logs the panic information to
as described above, but does not actually save the dump. The dump is marked as saved so that future invocations of do not create
duplicate log entries.
Only preserves swap-endangered dump device contents into crash
image files. Swap-endangered dump devices are those devices that are also configured as swap devices by the system. If all dump
devices are configured as swap devices, the entire dump will be preserved in the crash directory. If no swap devices are used as
dump devices (dedicated dump devices), only the file and kernel modules will be copied into the crash directory.
Resaves a dump that a previous invocation of
has marked as already saved. This is useful if the first invocation did ran out of space, and enough space has since been freed to
Enables additional progress messages and diagnostics.
will compress all physical memory image files and kernel module files
in the dump directory. This option is ignored if the dump image on the dump device is already compressed. See crashconf(2). In
this case, a warning message will be printed.
will not compress any files in the dump directory.
If neither nor is specified and the amount of free disk space is less than the total dump size, will compress the image files.
is the name of the device containing the header of the raw crash image. The console messages from the time of the panic will iden-
tify the major and minor numbers of this device. This option, in combination with can be used to tell where to find the dump in
the rare instances that doesn't know where to look.
offset is the offset in kBytes, relative to the beginning of the device specified with above, of the header of the raw crash image. The
console messages from the time of the panic will identify this offset. This option, in combination with can be used to tell where
to find the dump in the rare instances that doesn't know where to look.
sysfile is the name of a file containing the image of the system that produced the core dump (that is, the system running when the crash
occurred). If this option is not specified, gets the file name from the dump itself. If the file containing the image of the sys-
tem that caused the crash has changed, use this option to specify the new file name.
minfree is the amount of free space (in kBytes) that must be available for ordinary user files in the file system into which the dump will
be saved, in addition to space reserved for the superuser. If necessary, only part of the dump will be saved to achieve this
requirement. calculates the amount of disk space available when it starts saving the dump. Any space used by other processes
while dump is being saved is not taken into account.
minfree may be specified in bytes kilobytes megabytes or gigabytes The default minfree value is zero, and the default unit is kilo-
is the size (default kBytes) of a single physical memory image file before compression. The kByte value must be a multiple of page
size (divisible by 4) and between 64 and 1048576. chunksize may be specified in units of bytes kilobytes megabytes or gigabytes
Larger numbers increase compression efficiency at the expense of both time and debugging time. If is not specified, a default is
chosen based on the physical memory size and the amount of available file system space. If the dump image on the dump device is
compressed, then the chunksize specification is only used as a size limit for the images copied into the file system. See crash-
conf(2). If the size specified is smaller than the chunk size used for compression while dumping, then a warning message will be
printed and the compression chunk size used by the dump will be used to create the file system images.
is the tape device where the crash dump will be written. Crash dumps that are written to tape are written using a format. The
crash dump tape can be read using tar(1).
When the option is specified, the option is not allowed and the whole dump is always preserved. In addition, and are not allowed
and is ignored. Also, when is specified, will not perform any compression.
When dirname is specified with the option, dirname is the name of the existing directory where the file is created; the default
directory is The file is the first file that is written out to the dump tape. This file is written a second time once all the dump
files have been written. The first copy of the file only contains crash dump header information and its filename on tape is It
does not contain information for the module and image files.
When writing to tape, the tape device must be online otherwise the command will fail with an error. Additionally, when reaches
end-of-tape, it will prompt the user for the next tape. Any tape errors encountered will result in a generic tape error.
Defines the interaction between
and opt can be one of the following values:
Do not run from
(default) Call each time finishes saving the image from each dump device. This option provides the most efficient use of paging
Only call when finishes saving the image file from all dump devices. If this option is used, no additional paging space other
than the primary paging space is available until the complete crash dump image is saved. This option provides a second
chance to retrieve the crash image if fails on first attempt.
For compatibility with earlier syntax, the values of and can be used in place of and respectively. This usage is obsolescent.
Upon exit, returns the following values:
A crash dump was found and saved,
or has preserved dump information from the primary swap device and is continuing to run in the background to complete its
A crash dump could not be saved due to an error.
No crash dump was found to save.
A partial crash dump was saved, but there was insufficient space to
preserve the complete dump.
The savecrash process continued in the background, see the file for actual results.
relies on the expectation that device numbers have the same meaning (point to the same devices) at the time the system dumps and at the
time the dump is saved. If, after a crash, the system was booted from a different boot device in order to run it is possible that this
expectation will not be met. If so, may save an incomplete or incorrect dump or may fail to save a dump at all. Such cases cannot be
reliably detected, so there may be no warning or error message.
If encounters an error while running in the background (such as running out of space), it will not be easily detectable by the caller. If
the caller must ensure that the operation was successful, for example before writing to a dump device, the caller should specify to force
to run in the foreground, and should then examine the exit status of the process when it finishes.
was developed by HP and the University of California, Berkeley.
savecrash startup configuration file
savecrash startup file
crash dump number
default kernel image saved by savecrash
adb(1), tar(1), crashutil(1M), crashconf(1M), swapon(1M).