xref: /netbsd-src/libexec/lfs_cleanerd/lfs_cleanerd.8 (revision 924795e69c8bb3f17afd8fcbb799710cc1719dc4)
1.\"	$NetBSD: lfs_cleanerd.8,v 1.21 2021/07/31 15:02:54 andvar 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 J Ar raw-device
43.Op Fl l Ar load-threshold
44.Op Fl n Ar number-of-segments
45.Op Fl r Ar report-frequency
46.Op Fl S Ar semaphore-address
47.Op Fl t Ar timeout
48.Pa node
49.Sh DESCRIPTION
50The
51.Nm
52command starts a daemon process which garbage-collects
53the log-structured file system residing at the point named by
54.Ar node
55in the global file system namespace.
56This command is normally executed by
57.Xr mount_lfs 8
58when the log-structured file system is mounted.
59The daemon will exit within a few minutes
60of when the file system it was cleaning is unmounted.
61.Pp
62Garbage collection on a log-structured file system is done by scanning
63the file system's segments for active, i.e. referenced, data and copying
64it to new segments.
65When all of the active data in a given segment has been copied to a new
66segment that segment can be marked as empty, thus reclaiming the space
67taken by the inactive data which was in it.
68.Pp
69The following options are available:
70.Bl -tag -width indent
71.It Fl b
72Use bytes written, rather than segments read, when determining how many
73segments to clean at once.
74.It Fl c
75Coalescing mode.
76For each live inode, check to see if it has too many
77blocks that are not contiguous, and if it does, rewrite it.
78After a single pass through the filesystem the cleaner will exit.
79This option has been reported to corrupt file data; do not use it.
80.It Fl D
81Stay in the foreground, do not become a daemon process.
82Does not print additional debugging information (in contrast to
83.Fl d ) .
84.It Fl d
85Run in debug mode.
86Do not become a daemon process, and print debugging information.
87More
88.Fl d
89s give more detailed debugging information.
90.It Fl f
91Use filesystem idle time as the criterion for aggressive cleaning,
92instead of system load.
93.It Fl i Ar segment-number
94Invalidate the segment with segment number
95.Ar segment-number .
96This option is used by
97.Xr resize_lfs 8 ,
98and should not be specified on the command line.
99.It Fl J Ar raw device
100Specify the raw device that the cleaner is to work against rather than
101trying to figure it out from the mount point.
102This is mostly useful when the cleaner is compiled into
103.Xr rump_lfs 8
104and the ATF test framework.
105.It Fl l Ar load-threshold
106Clean more aggressively when the system load is below the given threshold.
107The default threshold is 0.2.
108.It Fl m
109Does nothing.
110This option is present for historical compatibility.
111.It Fl n Ar number-of-segments
112Clean this number of segments at a time: that is, pass this many
113segments' blocks through a single call to lfs_markv, or, if
114.Fl b
115was also given, pass this many segments' worth of blocks through a
116single call to lfs_markv.
117.It Fl q
118Quit after cleaning once.
119.It Fl r Ar report-frequency
120Give an efficiency report after every
121.Ar report-frequency
122times through the main loop.
123.It Fl S Ar semaphore address
124When the cleaner code is compiled into
125.Xr rump_lfs 8
126and the ATF frame work, this option allows for a synchronization
127semaphore to be specified.
128This option is not available in the stand-alone
129.Nm .
130.It Fl s
131When cleaning the file system,
132send only a few blocks through lfs_markv at a time.
133Don't use this option.
134.It Fl t Ar timeout
135Poll the filesystem every
136.Ar timeout
137seconds, looking for opportunities to clean.
138The default is 300, that is, five minutes.
139Note that
140.Nm
141will be automatically awakened when the filesystem is active,
142so it is not usually necessary to set
143.Ar timeout
144to a low value.
145.El
146.Sh SEE ALSO
147.Xr lfs_bmapv 2 ,
148.Xr lfs_markv 2 ,
149.Xr lfs_segwait 2 ,
150.Xr mount_lfs 8 ,
151.Xr rump_lfs 8
152.Sh HISTORY
153The
154.Nm
155utility first appeared in
156.Bx 4.4 .
157