xref: /freebsd/sbin/savecore/savecore.8 (revision 0a5c04a8)
18fae3551SRodney W. Grimes.\" Copyright (c) 1980, 1991, 1993
28fae3551SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
38fae3551SRodney W. Grimes.\"
48fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
58fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions
68fae3551SRodney W. Grimes.\" are met:
78fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
88fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
98fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
108fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
118fae3551SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
138fae3551SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
148fae3551SRodney W. Grimes.\"    without specific prior written permission.
158fae3551SRodney W. Grimes.\"
168fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
178fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
188fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
198fae3551SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
208fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
218fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
228fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
238fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
248fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
268fae3551SRodney W. Grimes.\" SUCH DAMAGE.
278fae3551SRodney W. Grimes.\"
284be4929cSGarrett Wollman.\"     From: @(#)savecore.8	8.1 (Berkeley) 6/5/93
297f3dea24SPeter Wemm.\" $FreeBSD$
308fae3551SRodney W. Grimes.\"
310a5c04a8SMitchell Horne.Dd April 4, 2022
328fae3551SRodney W. Grimes.Dt SAVECORE 8
339fe48c6eSRuslan Ermilov.Os
348fae3551SRodney W. Grimes.Sh NAME
358fae3551SRodney W. Grimes.Nm savecore
368fae3551SRodney W. Grimes.Nd "save a core dump of the operating system"
378fae3551SRodney W. Grimes.Sh SYNOPSIS
387c7fb079SRuslan Ermilov.Nm
398fae3551SRodney W. Grimes.Fl c
40349d039bSPawel Jakub Dawidek.Op Fl v
41349d039bSPawel Jakub Dawidek.Op Ar device ...
427c7fb079SRuslan Ermilov.Nm
43628d16a3SDoug Barton.Fl C
44628d16a3SDoug Barton.Op Fl v
45349d039bSPawel Jakub Dawidek.Op Ar device ...
46628d16a3SDoug Barton.Nm
470a5c04a8SMitchell Horne.Fl L
480a5c04a8SMitchell Horne.Op Fl fvZz
490a5c04a8SMitchell Horne.Op Fl m Ar maxdumps
500a5c04a8SMitchell Horne.Op Ar directory
510a5c04a8SMitchell Horne.Nm
5206691045SCraig Rodrigues.Op Fl -libxo
53bc7ed46bSGleb Smirnoff.Op Fl fkuvz
54eeff0b1bSPawel Jakub Dawidek.Op Fl m Ar maxdumps
55edc4f96eSBill Fenner.Op Ar directory Op Ar device ...
568fae3551SRodney W. Grimes.Sh DESCRIPTION
571fa8142dSRuslan ErmilovThe
581fa8142dSRuslan Ermilov.Nm
591fa8142dSRuslan Ermilovutility
60edc4f96eSBill Fennercopies a core dump into
611fa8142dSRuslan Ermilov.Ar directory ,
62edc4f96eSBill Fenneror the current working directory if no
631fa8142dSRuslan Ermilov.Ar directory
64edc4f96eSBill Fennerargument is given,
658fae3551SRodney W. Grimesand enters a reboot message and information about the core dump into
668fae3551SRodney W. Grimesthe system log.
678fae3551SRodney W. Grimes.Pp
688fae3551SRodney W. GrimesThe options are as follows:
69eeff0b1bSPawel Jakub Dawidek.Bl -tag -width ".Fl m Ar maxdumps"
7006691045SCraig Rodrigues.It Fl -libxo
7106691045SCraig RodriguesGenerate output via
7206691045SCraig Rodrigues.Xr libxo 3
7306691045SCraig Rodriguesin a selection of different human and machine readable formats.
7406691045SCraig RodriguesSee
7506691045SCraig Rodrigues.Xr xo_parse_args 3
7606691045SCraig Rodriguesfor details on command line arguments.
77628d16a3SDoug Barton.It Fl C
78628d16a3SDoug BartonCheck to see if a dump exists,
79628d16a3SDoug Bartonand display a brief message to indicate the status.
80628d16a3SDoug BartonAn exit status of 0 indicates that a dump is there,
81628d16a3SDoug Barton1 indicates that none exists.
82628d16a3SDoug BartonThis option is compatible only with the
83628d16a3SDoug Barton.Op Fl v
84628d16a3SDoug Bartonoption.
858fae3551SRodney W. Grimes.It Fl c
86f9b52c93SPhilippe CharnierClear the dump, so that future invocations of
87f9b52c93SPhilippe Charnier.Nm
888fae3551SRodney W. Grimeswill ignore it.
898fae3551SRodney W. Grimes.It Fl f
905fb7027cSDavid E. O'BrienForce a dump to be taken even if either the dump was cleared or if the
915fb7027cSDavid E. O'Briendump header information is inconsistent.
924c98f36dSDag-Erling Smørgrav.It Fl k
934c98f36dSDag-Erling SmørgravDo not clear the dump after saving it.
940a5c04a8SMitchell Horne.It Fl L
950a5c04a8SMitchell HorneInstruct
960a5c04a8SMitchell Horne.Nm
970a5c04a8SMitchell Horneto generate and save a kernel dump of the running system, rather than
980a5c04a8SMitchell Hornecopying one from a dump device.
99eeff0b1bSPawel Jakub Dawidek.It Fl m Ar maxdumps
100eeff0b1bSPawel Jakub DawidekMaximum number of dumps to store.
101eeff0b1bSPawel Jakub DawidekOnce the number of stored dumps is equal to
102eeff0b1bSPawel Jakub Dawidek.Ar maxdumps
103eeff0b1bSPawel Jakub Dawidekthe counter will restart from
104eeff0b1bSPawel Jakub Dawidek.Dv 0 .
105bc7ed46bSGleb Smirnoff.It Fl u
106bc7ed46bSGleb SmirnoffUncompress the dump in case it was compressed by the kernel.
1078fae3551SRodney W. Grimes.It Fl v
108f9b52c93SPhilippe CharnierPrint out some additional debugging information.
109ff869641SPhilip PaepsSpecify twice for more information.
1100a5c04a8SMitchell Horne.It Fl Z
1110a5c04a8SMitchell HorneCompress the dump (see
1120a5c04a8SMitchell Horne.Xr zstd 1 ) .
1130a5c04a8SMitchell HorneThis option is only supported in conjunction with the
1140a5c04a8SMitchell Horne.Fl L
1150a5c04a8SMitchell Horneoption.
1160a5c04a8SMitchell HorneRegular dumps can be configured for compression with zstd using
1170a5c04a8SMitchell Horne.Xr dumpon 8 .
1188fae3551SRodney W. Grimes.It Fl z
11964a16434SMark JohnstonCompress the dump (see
120dff462c3SKris Kennaway.Xr gzip 1 ) .
12164a16434SMark JohnstonThe dump may already be compressed if the kernel was configured to
12264a16434SMark Johnstondo so by
12364a16434SMark Johnston.Xr dumpon 8 .
12464a16434SMark JohnstonIn this case, the option has no effect.
1250a5c04a8SMitchell Horne.Pp
1260a5c04a8SMitchell HorneIf used in conjunction with the
1270a5c04a8SMitchell Horne.Fl L
1280a5c04a8SMitchell Horneoption, the requested live dump will be compressed with gzip.
1298fae3551SRodney W. Grimes.El
1308fae3551SRodney W. Grimes.Pp
1311fa8142dSRuslan ErmilovThe
1321fa8142dSRuslan Ermilov.Nm
1331fa8142dSRuslan Ermilovutility
134edc4f96eSBill Fennerlooks for dumps on each device specified by the
135edc4f96eSBill Fenner.Ar device
136edc4f96eSBill Fennerargument(s), or on each device in
137edc4f96eSBill Fenner.Pa /etc/fstab
1381fa8142dSRuslan Ermilovmarked as
1391fa8142dSRuslan Ermilov.Dq dump
1401fa8142dSRuslan Ermilovor
1411fa8142dSRuslan Ermilov.Dq swap .
1421fa8142dSRuslan ErmilovThe
1431fa8142dSRuslan Ermilov.Nm
1441fa8142dSRuslan Ermilovutility
145edc4f96eSBill Fennerchecks the core dump in various ways to make sure that it is complete.
1468fae3551SRodney W. GrimesIf it passes these checks, it saves the core image in
1478fae3551SRodney W. Grimes.Ar directory Ns Pa /vmcore.#
148edc4f96eSBill Fennerand information about the core in
14920ba6b0dSRuslan Ermilov.Ar directory Ns Pa /info.# .
150480f31c2SKonrad WitaszczykIf the core is encrypted, it saves the dump key in
151480f31c2SKonrad Witaszczyk.Ar directory Ns Pa /key.# .
152480f31c2SKonrad WitaszczykThe core can be later decrypted using
153480f31c2SKonrad Witaszczyk.Xr decryptcore 8 .
15410187caeSRobert WatsonFor kernel textdumps generated with the
15510187caeSRobert Watson.Xr textdump 4
15610187caeSRobert Watsonfacility, output will be stored in the
15710187caeSRobert Watson.Xr tar 5
15810187caeSRobert Watsonformat and named
15920ba6b0dSRuslan Ermilov.Ar directory Ns Pa /textdump.tar.# .
16020ba6b0dSRuslan ErmilovThe
16120ba6b0dSRuslan Ermilov.Dq #
16220ba6b0dSRuslan Ermilovis the number from the first line of the file
1638fae3551SRodney W. Grimes.Ar directory Ns Pa /bounds ,
1648fae3551SRodney W. Grimesand it is incremented and stored back into the file each time
165f9b52c93SPhilippe Charnier.Nm
1668fae3551SRodney W. Grimessuccessfully runs.
1678fae3551SRodney W. Grimes.Pp
1681fa8142dSRuslan ErmilovThe
1691fa8142dSRuslan Ermilov.Nm
1701fa8142dSRuslan Ermilovutility
1718fae3551SRodney W. Grimesalso checks the available disk space before attempting to make the copies.
1728fae3551SRodney W. GrimesIf there is insufficient disk space in the file system containing
1738fae3551SRodney W. Grimes.Ar directory ,
1748fae3551SRodney W. Grimesor if the file
1758fae3551SRodney W. Grimes.Ar directory Ns Pa /minfree
1768fae3551SRodney W. Grimesexists and the number of free kilobytes (for non-superusers) in the
1778fae3551SRodney W. Grimesfile system after the copies were made would be less than the number
1788fae3551SRodney W. Grimesin the first line of this file, the copies are not attempted.
1798fae3551SRodney W. Grimes.Pp
1808fae3551SRodney W. GrimesIf
181f9b52c93SPhilippe Charnier.Nm
1828fae3551SRodney W. Grimessuccessfully copies the kernel and the core dump, the core dump is cleared
1838fae3551SRodney W. Grimesso that future invocations of
184f9b52c93SPhilippe Charnier.Nm
1858fae3551SRodney W. Grimeswill ignore it.
1868fae3551SRodney W. Grimes.Pp
1871fa8142dSRuslan ErmilovThe
1881fa8142dSRuslan Ermilov.Nm
1891fa8142dSRuslan Ermilovutility
1908fae3551SRodney W. Grimesis meant to be called near the end of the initialization file
1918fae3551SRodney W. Grimes.Pa /etc/rc
1928fae3551SRodney W. Grimes(see
1938fae3551SRodney W. Grimes.Xr rc 8 ) .
1948fae3551SRodney W. Grimes.Sh SEE ALSO
195dff462c3SKris Kennaway.Xr gzip 1 ,
1960a5c04a8SMitchell Horne.Xr zstd 1 ,
197e8ae41c3SRuslan Ermilov.Xr getbootfile 3 ,
19806691045SCraig Rodrigues.Xr libxo 3 ,
19906691045SCraig Rodrigues.Xr xo_parse_args 3 ,
2000a5c04a8SMitchell Horne.Xr mem 4 ,
20110187caeSRobert Watson.Xr textdump 4 ,
202138f7e4bSTom Rhodes.Xr tar 5 ,
2037dc5b440SEdward Tomasz Napierala.Xr crashinfo 8 ,
204480f31c2SKonrad Witaszczyk.Xr decryptcore 8 ,
205e2fb2db5SNick Hibma.Xr dumpon 8 ,
2068fae3551SRodney W. Grimes.Xr syslogd 8
2078fae3551SRodney W. Grimes.Sh HISTORY
2088fae3551SRodney W. GrimesThe
2098fae3551SRodney W. Grimes.Nm
210629e80efSPhilippe Charnierutility appeared in
2118fae3551SRodney W. Grimes.Bx 4.1 .
21210187caeSRobert Watson.Pp
21310187caeSRobert WatsonSupport for kernel textdumps appeared in
2142a72feb4SChristian Brueffer.Fx 7.1 .
2156087df9eSRuslan Ermilov.Sh BUGS
2166087df9eSRuslan ErmilovThe minfree code does not consider the effect of compression or sparse files.
217