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