xref: /netbsd-src/libexec/lfs_cleanerd/lfs_cleanerd.8 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: lfs_cleanerd.8,v 1.18 2009/08/06 21:18:54 wiz Exp $
2.\"
3.\" Copyright (c) 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.\"	from: @(#)lfs_cleanerd.8	8.2 (Berkeley) 12/11/93
31.\"
32.Dd August 6, 2009
33.Dt LFS_CLEANERD 8
34.Os
35.Sh NAME
36.Nm lfs_cleanerd
37.Nd garbage collect a log-structured file system
38.Sh SYNOPSIS
39.Nm
40.Op Fl bcDdfmqs
41.Op Fl i Ar segment-number
42.Op Fl l Ar load-threshhold
43.Op Fl n Ar number-of-segments
44.Op Fl r Ar report-frequency
45.Op Fl t Ar timeout
46.Pa node
47.Sh DESCRIPTION
48The
49.Nm
50command starts a daemon process which garbage-collects
51the log-structured file system residing at the point named by
52.Ar node
53in the global file system namespace.
54This command is normally executed by
55.Xr mount_lfs 8
56when the log-structured file system is mounted.
57The daemon will exit within a few minutes
58of when the file system it was cleaning is unmounted.
59.Pp
60Garbage collection on a log-structured file system is done by scanning
61the file system's segments for active, i.e. referenced, data and copying
62it to new segments.
63When all of the active data in a given segment has been copied to a new
64segment that segment can be marked as empty, thus reclaiming the space
65taken by the inactive data which was in it.
66.Pp
67The following options are available:
68.Bl -tag -width indent
69.It Fl b
70Use bytes written, rather than segments read, when determining how many
71segments to clean at once.
72.It Fl c
73Coalescing mode.
74For each live inode, check to see if it has too many
75blocks that are not contiguous, and if it does, rewrite it.
76After a single pass through the filesystem the cleaner will exit.
77This option has been reported to corrupt file data; do not use it.
78.It Fl D
79Stay in the foreground, do not become a daemon process.
80Does not print additional debugging information (in contrast to
81.Fl d ) .
82.It Fl d
83Run in debug mode.
84Do not become a daemon process, and print debugging information.
85More
86.Fl d
87s give more detailed debugging information.
88.It Fl f
89Use filesystem idle time as the criterion for aggressive cleaning,
90instead of system load.
91.It Fl i Ar segment-number
92Invalidate the segment with segment number
93.Ar segment-number .
94This option is used by
95.Xr resize_lfs 8 ,
96and should not be specified on the command line.
97.It Fl l Ar load-threshhold
98Clean more aggressively when the system load is below the given threshhold.
99The default threshhold is 0.2.
100.It Fl m
101Does nothing.
102This option is present for historical compatibility.
103.It Fl n Ar number-of-segments
104Clean this number of segments at a time: that is, pass this many
105segments' blocks through a single call to lfs_markv, or, if
106.Fl b
107was also given, pass this many segments' worth of blocks through a
108single call to lfs_markv.
109.It Fl q
110Quit after cleaning once.
111.It Fl r Ar report-frequency
112Give an efficiency report after every
113.Ar report-frequency
114times through the main loop.
115.It Fl s
116When cleaning the file system,
117send only a few blocks through lfs_markv at a time.
118Don't use this option.
119.It Fl t Ar timeout
120Poll the filesystem every
121.Ar timeout
122seconds, looking for opportunities to clean.
123The default is 300, that is, five minutes.
124Note that
125.Nm
126will be automatically awakened when the filesystem is active,
127so it is not usually necessary to set
128.Ar timeout
129to a low value.
130.El
131.Sh SEE ALSO
132.Xr lfs_bmapv 2 ,
133.Xr lfs_markv 2 ,
134.Xr lfs_segwait 2 ,
135.Xr mount_lfs 8
136.Sh HISTORY
137The
138.Nm
139utility first appeared in
140.Bx 4.4 .
141