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