xref: /freebsd/sbin/savecore/savecore.8 (revision a2b560cc)
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.\" 3. 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.\"
30.Dd April 4, 2022
31.Dt SAVECORE 8
32.Os
33.Sh NAME
34.Nm savecore
35.Nd "save a core dump of the operating system"
36.Sh SYNOPSIS
37.Nm
38.Fl c
39.Op Fl v
40.Op Ar device ...
41.Nm
42.Fl C
43.Op Fl v
44.Op Ar device ...
45.Nm
46.Fl L
47.Op Fl fvZz
48.Op Fl m Ar maxdumps
49.Op Ar directory
50.Nm
51.Op Fl -libxo
52.Op Fl fkuvz
53.Op Fl m Ar maxdumps
54.Op Ar directory Op Ar device ...
55.Sh DESCRIPTION
56The
57.Nm
58utility
59copies a core dump into
60.Ar directory ,
61or the current working directory if no
62.Ar directory
63argument is given,
64and enters a reboot message and information about the core dump into
65the system log.
66.Pp
67The options are as follows:
68.Bl -tag -width ".Fl m Ar maxdumps"
69.It Fl -libxo
70Generate output via
71.Xr libxo 3
72in a selection of different human and machine readable formats.
73See
74.Xr xo_parse_args 3
75for details on command line arguments.
76.It Fl C
77Check to see if a dump exists,
78and display a brief message to indicate the status.
79An exit status of 0 indicates that a dump is there,
801 indicates that none exists.
81This option is compatible only with the
82.Op Fl v
83option.
84.It Fl c
85Clear the dump, so that future invocations of
86.Nm
87will ignore it.
88.It Fl f
89Force a dump to be taken even if either the dump was cleared or if the
90dump header information is inconsistent.
91.It Fl k
92Do not clear the dump after saving it.
93.It Fl L
94Instruct
95.Nm
96to generate and save a kernel dump of the running system, rather than
97copying one from a dump device.
98.It Fl m Ar maxdumps
99Maximum number of dumps to store.
100Once the number of stored dumps is equal to
101.Ar maxdumps
102the counter will restart from
103.Dv 0 .
104.It Fl u
105Uncompress the dump in case it was compressed by the kernel.
106.It Fl v
107Print out some additional debugging information.
108Specify twice for more information.
109.It Fl Z
110Compress the dump (see
111.Xr zstd 1 ) .
112This option is only supported in conjunction with the
113.Fl L
114option.
115Regular dumps can be configured for compression with zstd using
116.Xr dumpon 8 .
117.It Fl z
118Compress the dump (see
119.Xr gzip 1 ) .
120The dump may already be compressed if the kernel was configured to
121do so by
122.Xr dumpon 8 .
123In this case, the option has no effect.
124.Pp
125If used in conjunction with the
126.Fl L
127option, the requested live dump will be compressed with gzip.
128.El
129.Pp
130The
131.Nm
132utility
133looks for dumps on each device specified by the
134.Ar device
135argument(s), or on each device in
136.Pa /etc/fstab
137marked as
138.Dq dump
139or
140.Dq swap .
141The
142.Nm
143utility
144checks the core dump in various ways to make sure that it is complete.
145If it passes these checks, it saves the core image in
146.Ar directory Ns Pa /vmcore.#
147and information about the core in
148.Ar directory Ns Pa /info.# .
149If the core is encrypted, it saves the dump key in
150.Ar directory Ns Pa /key.# .
151The core can be later decrypted using
152.Xr decryptcore 8 .
153For kernel textdumps generated with the
154.Xr textdump 4
155facility, output will be stored in the
156.Xr tar 5
157format and named
158.Ar directory Ns Pa /textdump.tar.# .
159The
160.Dq #
161is the number from the first line of the file
162.Ar directory Ns Pa /bounds ,
163and it is incremented and stored back into the file each time
164.Nm
165successfully runs.
166.Pp
167The
168.Nm
169utility
170also checks the available disk space before attempting to make the copies.
171If there is insufficient disk space in the file system containing
172.Ar directory ,
173or if the file
174.Ar directory Ns Pa /minfree
175exists and the number of free kilobytes (for non-superusers) in the
176file system after the copies were made would be less than the number
177in the first line of this file, the copies are not attempted.
178.Pp
179If
180.Nm
181successfully copies the kernel and the core dump, the core dump is cleared
182so that future invocations of
183.Nm
184will ignore it.
185.Pp
186The
187.Nm
188utility
189is meant to be called near the end of the initialization file
190.Pa /etc/rc
191(see
192.Xr rc 8 ) .
193.Sh SEE ALSO
194.Xr gzip 1 ,
195.Xr zstd 1 ,
196.Xr getbootfile 3 ,
197.Xr libxo 3 ,
198.Xr xo_parse_args 3 ,
199.Xr mem 4 ,
200.Xr textdump 4 ,
201.Xr tar 5 ,
202.Xr crashinfo 8 ,
203.Xr decryptcore 8 ,
204.Xr dumpon 8 ,
205.Xr syslogd 8
206.Sh HISTORY
207The
208.Nm
209utility appeared in
210.Bx 4.1 .
211.Pp
212Support for kernel textdumps appeared in
213.Fx 7.1 .
214.Sh BUGS
215The minfree code does not consider the effect of compression or sparse files.
216