xref: /netbsd-src/libexec/lfs_cleanerd/lfs_cleanerd.8 (revision c0179c282a5968435315a82f4128c61372c68fc3)
1.\"	$NetBSD: lfs_cleanerd.8,v 1.16 2006/11/18 18:43:25 tls 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 April 1, 2006
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 bcdfmqs
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
79Run in debug mode.
80Do not become a daemon process, and print debugging information.
81More
82.Fl d
83s give more detailed debugging information.
84.It Fl f
85Use filesystem idle time as the criterion for aggressive cleaning,
86instead of system load.
87.It Fl i Ar segment-number
88Invalidate the segment with segment number
89.Ar segment-number .
90This option is used by
91.Xr resize_lfs 8 ,
92and should not be specified on the command line.
93.It Fl l Ar load-threshhold
94Clean more aggressively when the system load is below the given threshhold.
95The default threshhold is 0.2.
96.It Fl m
97Does nothing.  This option is present for historical compatibility.
98.It Fl n Ar number-of-segments
99Clean this number of segments at a time: that is, pass this many
100segments' blocks through a single call to lfs_markv, or, if
101.Fl b
102was also given, pass this many segments' worth of blocks through a
103single call to lfs_markv.
104.It Fl q
105Quit after cleaning once.
106.It Fl r Ar report-frequency
107Give an efficiency report after every
108.Ar report-frequency
109times through the main loop.
110.It Fl s
111When cleaning the file system,
112send only a few blocks through lfs_markv at a time.
113Don't use this option.
114.It Fl t Ar timeout
115Poll the filesystem every
116.Ar timeout
117seconds, looking for opportunities to clean.
118The default is 300, that is, five minutes.
119Note that
120.Nm
121will be automatically awakened when the filesystem is active,
122so it is not usually necessary to set
123.Ar timeout
124to a low value.
125.El
126.Sh SEE ALSO
127.Xr lfs_bmapv 2 ,
128.Xr lfs_markv 2 ,
129.Xr lfs_segwait 2 ,
130.Xr mount_lfs 8
131.Sh HISTORY
132The
133.Nm
134utility first appeared in
135.Bx 4.4 .
136