xref: /netbsd/sbin/fsck_lfs/fsck_lfs.8 (revision c4a72b64)
1.\"	$NetBSD: fsck_lfs.8,v 1.11 2002/10/01 14:23:38 wiz Exp $
2.\"
3.\" Copyright (c) 1980, 1989, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	@(#)fsck.8	8.3 (Berkeley) 11/29/94
35.\"
36.Dd March 17, 1999
37.Dt FSCK_LFS 8
38.Os
39.Sh NAME
40.Nm fsck_lfs
41.Nd Log-structured File System consistency check and interactive repair
42.Sh SYNOPSIS
43.Nm fsck_lfs
44.Op Fl b Ar block#
45.Op Fl d
46.\" .Op Fl m
47.\" .Op Fl f
48.Op Fl p
49.Op Fl y
50.Op Fl n
51.Ar filesystem
52.Ar ...
53.Sh DESCRIPTION
54.Nm
55performs interactive filesystem consistency checks and repair for each of
56the filesystems specified on the command line.
57It is normally invoked from
58.Xr fsck 8 .
59.Pp
60The design of LFS takes care that no filesystem inconsistencies can
61happen unless hardware or software failures intervene.
62.Nm
63will report and optionally correct any such inconsistencies.
64.Pp
65For each corrected inconsistency one or more lines will be printed
66identifying the filesystem on which the correction will take place,
67and the nature of the correction.
68After successfully correcting a filesystem,
69.Nm
70will print the number of files on that filesystem,
71the number of used and free blocks,
72and the percentage of fragmentation.
73.Pp
74If sent a
75.Dv QUIT
76signal,
77.Nm
78will finish the filesystem checks, then exit with an abnormal return status.
79.Pp
80Without the
81.Fl p
82option,
83.Nm
84audits and interactively repairs inconsistent conditions for filesystems.
85If the filesystem is inconsistent the operator is prompted for concurrence
86before each correction is attempted.
87It should be noted that some of the corrective actions will result in
88some loss of data.
89The amount and severity of data lost may be determined from the diagnostic
90output.
91The default action for each consistency correction
92is to wait for the operator to respond
93.Li yes
94or
95.Li no .
96If the operator does not have write permission on the filesystem
97.Nm
98will default to a
99.Fl n
100action.
101.Pp
102The following flags are interpreted by
103.Nm "" .
104.Bl -tag -width indent
105.It Fl b
106Use the block specified immediately after the flag as
107the super block for the filesystem.
108.It Fl d
109Print debugging output.
110.\" .It Fl f
111.\" Force checking of file systems.  Normally, if a file system is cleanly
112.\" unmounted, the kernel will set a
113.\" .Dq clean flag
114.\" in the file system superblock, and
115.\" .Nm
116.\" will not check the file system.  This option forces
117.\" .Nm
118.\" to check the file system, regardless of the state of the clean flag.
119.\" .It Fl m
120.\" Use the mode specified in octal immediately after the flag as the
121.\" permission bits to use when creating the
122.\" .Pa lost+found
123.\" directory rather than the default 1700.
124.\" In particular, systems that do not wish to have lost files accessible
125.\" by all users on the system should use a more restrictive
126.\" set of permissions such as 700.
127.It Fl n
128Assume a no response to all questions asked by
129.Nm
130except for
131.Ql CONTINUE? ,
132which is assumed to be affirmative;
133do not open the filesystem for writing.
134.It Fl p
135Specify ``preen'' mode.
136Currently, in this mode
137.Nm
138simply checks validity of the newer checkpoint.
139.It Fl y
140Assume a yes response to all questions asked by
141.Nm "" ;
142this should be used with great caution as this is a free license
143to continue after essentially unlimited trouble has been encountered.
144.El
145.Pp
146.Bl -enum -offset indent -compact
147Inconsistencies checked are as follows:
148.It
149Blocks claimed by more than one inode.
150.It
151Blocks claimed by an inode outside the range of the filesystem.
152.It
153Incorrect link counts.
154.It
155Size checks:
156.Bl -item -offset indent -compact
157.It
158Directory size not a multiple of DIRBLKSIZ.
159.It
160Partially truncated file.
161.El
162.It
163Bad inode format.
164.It
165Directory checks:
166.Bl -item -offset indent -compact
167.It
168File pointing to unallocated inode.
169.It
170Inode number out of range.
171.It
172Dot or dot-dot not the first two entries of a directory
173or having the wrong inode number.
174.El
175.It
176Super Block checks:
177.Bl -item -offset indent -compact
178.It
179More blocks for inodes than there are in the filesystem.
180.It
181Segment block counts incorrect, or ``clean'' segments containing live data.
182.El
183.El
184.Pp
185Orphaned files and directories (allocated but unreferenced) are,
186with the operator's concurrence, reconnected by
187placing them in the
188.Pa lost+found
189directory.
190The name assigned is the inode number.
191If the
192.Pa lost+found
193directory does not exist, it is created.
194If there is insufficient space its size is increased.
195.Pp
196Because of inconsistencies between the block device and the buffer cache,
197the raw device should always be used.
198.Sh DIAGNOSTICS
199The diagnostics produced by
200.Nm
201are fully enumerated and explained in Appendix A of
202.Rs
203.%T "Fsck \- The UNIX File System Check Program"
204.Re
205.Sh SEE ALSO
206.Xr fstab 5 ,
207.Xr fsck 8 ,
208.Xr newfs_lfs 8 ,
209.Xr reboot 8
210.Sh HISTORY
211The
212.Nm
213program was first made available in
214.Nx 1.4 .
215.Sh AUTHORS
216Most of the
217.Nm
218program was taken from
219.Xr fsck_ffs 8 ;
220what was not was written by
221.An Konrad Schroder Aq perseant@hhhh.org .
222.Sh BUGS
223.Nm
224cannot currently perform a full roll-forward, or correct all of the
225errors that it can detect.
226