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