1.\" $OpenBSD: savecore.8,v 1.12 2000/11/09 17:53:06 aaron Exp $ 2.\" $NetBSD: savecore.8,v 1.11 1995/06/27 22:40:46 briggs Exp $ 3.\" 4.\" Copyright (c) 1980, 1991, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. All advertising materials mentioning features or use of this software 16.\" must display the following acknowledgement: 17.\" This product includes software developed by the University of 18.\" California, Berkeley and its contributors. 19.\" 4. Neither the name of the University nor the names of its contributors 20.\" may be used to endorse or promote products derived from this software 21.\" without specific prior written permission. 22.\" 23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33.\" SUCH DAMAGE. 34.\" 35.\" @(#)savecore.8 8.1 (Berkeley) 6/5/93 36.\" 37.Dd June 5, 1993 38.Dt SAVECORE 8 39.Os 40.Sh NAME 41.Nm savecore 42.Nd "save a core dump of the operating system" 43.Sh SYNOPSIS 44.Nm savecore 45.Fl c 46.Nm savecore 47.Op Fl fvz 48.Op Fl N Ar system 49.Ar directory 50.Sh DESCRIPTION 51.Nm 52copies the currently running kernel and its associated core dump into 53.Fa directory , 54and enters a reboot message and information about the core dump into 55the system log. 56.Pp 57The options are as follows: 58.Bl -tag -width Ds 59.It Fl c 60Clears the dump, so that future invocations of 61.Nm 62will ignore it. 63.It Fl f 64Forces a dump to be taken even if the dump doesn't appear correct or there 65is insufficient disk space. 66.It Fl N Ar system 67Use 68.Ar system 69as the kernel instead of the default 70.Pa /bsd . 71.It Fl v 72Prints out some additional debugging information. 73.It Fl z 74Compresses the core dump and kernel (see 75.Xr compress 1 ) . 76.El 77.Pp 78.Nm 79checks the core dump in various ways to make sure that it is current and 80that it corresponds to the currently running system. 81If it passes these checks, it saves the core image in 82.Ar directory Ns Pa /bsd.#.core 83and the system in 84.Ar directory Ns Pa /bsd.# 85(or in 86.Ar directory Ns Pa /bsd.#.core.Z 87and 88.Ar directory Ns Pa /bsd.#.Z , 89respectively, if the 90.Fl z 91option is used). 92The 93.Dq # 94is the number from the first line of the file 95.Ar directory Ns Pa /bounds , 96and it is incremented and stored back into the file each time 97.Nm 98successfully runs. 99.Pp 100.Nm 101also checks the available disk space before attempting to make the copies. 102If there is insufficient disk space in the filesystem containing 103.Ar directory , 104or if the file 105.Ar directory Ns Pa /minfree 106exists and the number of free kilobytes (for non-superusers) in the 107filesystem after the copies were made would be less than the number 108in the first line of this file, the copies are not attempted. 109.Pp 110If 111.Nm 112successfully copies the kernel and the core dump, the core dump is cleared 113so that future invocations of 114.Nm 115will ignore it. 116.Pp 117.Nm 118is meant to be called near the end of the initialization file 119.Pa /etc/rc 120(see 121.Xr rc 8 ) . 122.Sh FILES 123.Bl -tag -width /bsdxx -compact 124.It Pa /bsd 125current kernel 126.El 127.Sh BUGS 128The minfree code does not consider the effect of compression. 129.Sh SEE ALSO 130.Xr compress 1 , 131.Xr syslogd 8 132.Sh HISTORY 133The 134.Nm 135command appeared in 136.Bx 4.1 . 137