xref: /freebsd/lib/geom/cache/gcache.8 (revision 8a7df6c58d549bd2eaa5cad30b2ef93c3eca3c18)
1.\"-
2.\" Copyright (c) 2010 Edward Tomasz Napierala
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd September 28, 2026
27.Dt GCACHE 8
28.Os
29.Sh NAME
30.Nm gcache
31.Nd "control utility for CACHE GEOM class"
32.Sh SYNOPSIS
33.Nm
34.Cm create
35.Op Fl v
36.Op Fl b Ar blocksize
37.Op Fl s Ar size
38.Ar name
39.Ar prov
40.Nm
41.Cm configure
42.Op Fl v
43.Op Fl b Ar blocksize
44.Op Fl s Ar size
45.Ar name
46.Nm
47.Cm destroy
48.Op Fl fv
49.Ar name
50.Nm
51.Cm label
52.Op Fl v
53.Op Fl b Ar blocksize
54.Op Fl s Ar size
55.Ar name
56.Ar prov
57.Nm
58.Cm stop
59.Op Fl fv
60.Ar name ...
61.Nm
62.Cm clear
63.Op Fl v
64.Ar prov ...
65.Nm
66.Cm dump
67.Ar prov ...
68.Nm
69.Op Fl -libxo
70.Cm list
71.Nm
72.Op Fl -libxo
73.Cm status
74.Op Fl s Ar name
75.Nm
76.Cm load
77.Op Fl v
78.Nm
79.Cm unload
80.Op Fl v
81.Sh DESCRIPTION
82The
83.Nm
84utility is used to control GEOM cache, which can
85speed up read performance by sending fixed size
86read requests to its consumer.  It has been developed to address
87the problem of a horrible read performance of a 64\~KiB blocksize FS
88residing on a RAID3 array with 8 data components, where a single
89disk component would only get 8\~KiB read requests, thus effectively
90killing disk performance under high load.
91.Pp
92Caching can be configured using two different methods:
93.Dq manual
94or
95.Dq automatic .
96When using the
97.Dq manual
98method, no metadata are stored on the devices, so the cached
99device has to be configured by hand every time it is needed.
100The
101.Dq automatic
102method uses on-disk metadata to detect devices.
103Once devices are labeled, they will be automatically detected and
104configured.
105.Pp
106The first argument to
107.Nm
108indicates an action to be performed:
109.Bl -tag -width ".Cm destroy"
110.It Cm create
111Cache the given devices with specified
112.Ar name .
113This is the
114.Dq manual
115method.
116The kernel module
117.Pa geom_cache.ko
118will be loaded if it is not loaded already.
119.It Cm label
120Cache the given devices with the specified
121.Ar name .
122This is the
123.Dq automatic
124method, where metadata are stored in every device's last sector.
125The kernel module
126.Pa geom_cache.ko
127will be loaded if it is not loaded already.
128.It Cm stop
129Turn off existing cache device by its
130.Ar name .
131This command does not touch on-disk metadata!
132.It Cm destroy
133Same as
134.Cm stop .
135.It Cm clear
136Clear metadata on the given devices.
137.It Cm dump
138Dump metadata stored on the given devices.
139.It Cm list
140See
141.Xr geom 8 .
142.It Cm status
143See
144.Xr geom 8 .
145.It Cm load
146See
147.Xr geom 8 .
148.It Cm unload
149See
150.Xr geom 8 .
151.It Fl -libxo
152Generate output via
153.Xr libxo 3
154in a selection of different human and machine readable formats.
155See
156.Xr xo_options 7
157for details on command line arguments.
158.El
159.Pp
160Additional options:
161.Bl -tag -width indent
162.It Fl f
163Force the removal of the specified cache device.
164.It Fl v
165Be more verbose.
166.El
167.Sh SYSCTL VARIABLES
168The following
169.Xr sysctl 8
170variables can be used to control the behavior of the
171.Nm CACHE
172GEOM class.
173The default value is shown next to each variable.
174.Bl -tag -width indent
175.It Va kern.geom.cache.used_hi : No 20
176.It Va kern.geom.cache.used_lo : No 5
177.It Va kern.geom.cache.idletime : No 5
178.It Va kern.geom.cache.timeout : No 10
179.It Va kern.geom.cache.enable : No 1
180.It Va kern.geom.cache.debug : No 0
181Debug level of the
182.Nm CACHE
183GEOM class.
184This can be set to a number between 0 and 3 inclusive.
185If set to 0 minimal debug information is printed, and if set to 3 the
186maximum amount of debug information is printed.
187.El
188.Sh EXIT STATUS
189Exit status is 0 on success, and 1 if the command fails.
190.Sh SEE ALSO
191.Xr geom 4 ,
192.Xr xo_options 7 ,
193.Xr geom 8
194.Sh HISTORY
195The
196.Nm
197utility appeared in
198.Fx 7.0 .
199.Sh AUTHORS
200.An Ruslan Ermilov Aq Mt ru@FreeBSD.org
201