xref: /freebsd/sbin/savecore/savecore.8 (revision 12f110aa1ad3c9d0ead55bf80f2f994b4b845ffb)
1.\" Copyright (c) 1980, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 4. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     From: @(#)savecore.8	8.1 (Berkeley) 6/5/93
29.\" $FreeBSD$
30.\"
31.Dd December 17, 2012
32.Dt SAVECORE 8
33.Os
34.Sh NAME
35.Nm savecore
36.Nd "save a core dump of the operating system"
37.Sh SYNOPSIS
38.Nm
39.Fl c
40.Op Fl v
41.Op Ar device ...
42.Nm
43.Fl C
44.Op Fl v
45.Op Ar device ...
46.Nm
47.Op Fl fkvz
48.Op Fl m Ar maxdumps
49.Op Ar directory Op Ar device ...
50.Sh DESCRIPTION
51The
52.Nm
53utility
54copies a core dump into
55.Ar directory ,
56or the current working directory if no
57.Ar directory
58argument is given,
59and enters a reboot message and information about the core dump into
60the system log.
61.Pp
62The options are as follows:
63.Bl -tag -width ".Fl m Ar maxdumps"
64.It Fl C
65Check to see if a dump exists,
66and display a brief message to indicate the status.
67An exit status of 0 indicates that a dump is there,
681 indicates that none exists.
69This option is compatible only with the
70.Op Fl v
71option.
72.It Fl c
73Clear the dump, so that future invocations of
74.Nm
75will ignore it.
76.It Fl f
77Force a dump to be taken even if either the dump was cleared or if the
78dump header information is inconsistent.
79.It Fl k
80Do not clear the dump after saving it.
81.It Fl m Ar maxdumps
82Maximum number of dumps to store.
83Once the number of stored dumps is equal to
84.Ar maxdumps
85the counter will restart from
86.Dv 0 .
87.It Fl v
88Print out some additional debugging information.
89Specify twice for more information.
90.It Fl z
91Compress the core dump and kernel (see
92.Xr gzip 1 ) .
93.El
94.Pp
95The
96.Nm
97utility
98looks for dumps on each device specified by the
99.Ar device
100argument(s), or on each device in
101.Pa /etc/fstab
102marked as
103.Dq dump
104or
105.Dq swap .
106The
107.Nm
108utility
109checks the core dump in various ways to make sure that it is complete.
110If it passes these checks, it saves the core image in
111.Ar directory Ns Pa /vmcore.#
112and information about the core in
113.Ar directory Ns Pa /info.# .
114For kernel textdumps generated with the
115.Xr textdump 4
116facility, output will be stored in the
117.Xr tar 5
118format and named
119.Ar directory Ns Pa /textdump.tar.# .
120The
121.Dq #
122is the number from the first line of the file
123.Ar directory Ns Pa /bounds ,
124and it is incremented and stored back into the file each time
125.Nm
126successfully runs.
127.Pp
128The
129.Nm
130utility
131also checks the available disk space before attempting to make the copies.
132If there is insufficient disk space in the file system containing
133.Ar directory ,
134or if the file
135.Ar directory Ns Pa /minfree
136exists and the number of free kilobytes (for non-superusers) in the
137file system after the copies were made would be less than the number
138in the first line of this file, the copies are not attempted.
139.Pp
140If
141.Nm
142successfully copies the kernel and the core dump, the core dump is cleared
143so that future invocations of
144.Nm
145will ignore it.
146.Pp
147The
148.Nm
149utility
150is meant to be called near the end of the initialization file
151.Pa /etc/rc
152(see
153.Xr rc 8 ) .
154.Sh SEE ALSO
155.Xr gzip 1 ,
156.Xr getbootfile 3 ,
157.Xr textdump 4 ,
158.Xr tar 5 ,
159.Xr dumpon 8 ,
160.Xr syslogd 8
161.Sh HISTORY
162The
163.Nm
164utility appeared in
165.Bx 4.1 .
166.Pp
167Support for kernel textdumps appeared in
168.Fx 7.1 .
169.Sh BUGS
170The minfree code does not consider the effect of compression or sparse files.
171