xref: /freebsd/share/man/man4/geom.4 (revision 96d8f35f2a2bf13e0ecf203e3ce514a3c05e3691)
127c74787SPoul-Henning Kamp.\"
227c74787SPoul-Henning Kamp.\" Copyright (c) 2002 Poul-Henning Kamp
327c74787SPoul-Henning Kamp.\" Copyright (c) 2002 Networks Associates Technology, Inc.
427c74787SPoul-Henning Kamp.\" All rights reserved.
527c74787SPoul-Henning Kamp.\"
627c74787SPoul-Henning Kamp.\" This software was developed for the FreeBSD Project by Poul-Henning Kamp
727c74787SPoul-Henning Kamp.\" and NAI Labs, the Security Research Division of Network Associates, Inc.
827c74787SPoul-Henning Kamp.\" under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
927c74787SPoul-Henning Kamp.\" DARPA CHATS research program.
1027c74787SPoul-Henning Kamp.\"
1127c74787SPoul-Henning Kamp.\" Redistribution and use in source and binary forms, with or without
1227c74787SPoul-Henning Kamp.\" modification, are permitted provided that the following conditions
1327c74787SPoul-Henning Kamp.\" are met:
1427c74787SPoul-Henning Kamp.\" 1. Redistributions of source code must retain the above copyright
1527c74787SPoul-Henning Kamp.\"    notice, this list of conditions and the following disclaimer.
1627c74787SPoul-Henning Kamp.\" 2. Redistributions in binary form must reproduce the above copyright
1727c74787SPoul-Henning Kamp.\"    notice, this list of conditions and the following disclaimer in the
1827c74787SPoul-Henning Kamp.\"    documentation and/or other materials provided with the distribution.
1927c74787SPoul-Henning Kamp.\" 3. The names of the authors may not be used to endorse or promote
2027c74787SPoul-Henning Kamp.\"    products derived from this software without specific prior written
2127c74787SPoul-Henning Kamp.\"    permission.
2227c74787SPoul-Henning Kamp.\"
2327c74787SPoul-Henning Kamp.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2427c74787SPoul-Henning Kamp.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2527c74787SPoul-Henning Kamp.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2627c74787SPoul-Henning Kamp.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2727c74787SPoul-Henning Kamp.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2827c74787SPoul-Henning Kamp.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2927c74787SPoul-Henning Kamp.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3027c74787SPoul-Henning Kamp.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3127c74787SPoul-Henning Kamp.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3227c74787SPoul-Henning Kamp.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3327c74787SPoul-Henning Kamp.\" SUCH DAMAGE.
3427c74787SPoul-Henning Kamp.\"
35*96d8f35fSMariusz Zaborski.Dd July 8, 2024
3627c74787SPoul-Henning Kamp.Dt GEOM 4
37aa12cea2SUlrich Spörlein.Os
3827c74787SPoul-Henning Kamp.Sh NAME
3927c74787SPoul-Henning Kamp.Nm GEOM
4078ad5421SRuslan Ermilov.Nd "modular disk I/O request transformation framework"
419218a6ebSJoel Dahl.Sh SYNOPSIS
429218a6ebSJoel Dahl.Cd options GEOM_CACHE
439218a6ebSJoel Dahl.Cd options GEOM_CONCAT
449218a6ebSJoel Dahl.Cd options GEOM_ELI
459218a6ebSJoel Dahl.Cd options GEOM_GATE
469218a6ebSJoel Dahl.Cd options GEOM_JOURNAL
479218a6ebSJoel Dahl.Cd options GEOM_LABEL
489218a6ebSJoel Dahl.Cd options GEOM_LINUX_LVM
49fcdb1ffcSAndrey V. Elsukov.Cd options GEOM_MAP
509218a6ebSJoel Dahl.Cd options GEOM_MIRROR
5128ffa766SEdward Tomasz Napierala.Cd options GEOM_MOUNTVER
529218a6ebSJoel Dahl.Cd options GEOM_MULTIPATH
539218a6ebSJoel Dahl.Cd options GEOM_NOP
549218a6ebSJoel Dahl.Cd options GEOM_PART_APM
559218a6ebSJoel Dahl.Cd options GEOM_PART_BSD
56fcdb1ffcSAndrey V. Elsukov.Cd options GEOM_PART_BSD64
579218a6ebSJoel Dahl.Cd options GEOM_PART_EBR
589218a6ebSJoel Dahl.Cd options GEOM_PART_EBR_COMPAT
599218a6ebSJoel Dahl.Cd options GEOM_PART_GPT
609218a6ebSJoel Dahl.Cd options GEOM_PART_LDM
619218a6ebSJoel Dahl.Cd options GEOM_PART_MBR
629218a6ebSJoel Dahl.Cd options GEOM_RAID
639218a6ebSJoel Dahl.Cd options GEOM_RAID3
649218a6ebSJoel Dahl.Cd options GEOM_SHSEC
659218a6ebSJoel Dahl.Cd options GEOM_STRIPE
669218a6ebSJoel Dahl.Cd options GEOM_UZIP
679218a6ebSJoel Dahl.Cd options GEOM_VIRSTOR
689218a6ebSJoel Dahl.Cd options GEOM_ZERO
6927c74787SPoul-Henning Kamp.Sh DESCRIPTION
7078ad5421SRuslan ErmilovThe
7178ad5421SRuslan Ermilov.Nm
7278ad5421SRuslan Ermilovframework provides an infrastructure in which
7378ad5421SRuslan Ermilov.Dq classes
7427c74787SPoul-Henning Kampcan perform transformations on disk I/O requests on their path from
7527c74787SPoul-Henning Kampthe upper kernel to the device drivers and back.
7627c74787SPoul-Henning Kamp.Pp
7778ad5421SRuslan ErmilovTransformations in a
7878ad5421SRuslan Ermilov.Nm
7978ad5421SRuslan Ermilovcontext range from the simple geometric
80d773aebdSPoul-Henning Kampdisplacement performed in typical disk partitioning modules over RAID
8127c74787SPoul-Henning Kampalgorithms and device multipath resolution to full blown cryptographic
8227c74787SPoul-Henning Kampprotection of the stored data.
8327c74787SPoul-Henning Kamp.Pp
8478ad5421SRuslan ErmilovCompared to traditional
8578ad5421SRuslan Ermilov.Dq "volume management" ,
8678ad5421SRuslan Ermilov.Nm
8778ad5421SRuslan Ermilovdiffers from most
8827c74787SPoul-Henning Kampand in some cases all previous implementations in the following ways:
8927c74787SPoul-Henning Kamp.Bl -bullet
9027c74787SPoul-Henning Kamp.It
9178ad5421SRuslan Ermilov.Nm
9278ad5421SRuslan Ermilovis extensible.
935203edcdSRuslan ErmilovIt is trivially simple to write a new class
945203edcdSRuslan Ermilovof transformation and it will not be given stepchild treatment.
955203edcdSRuslan ErmilovIf
9627c74787SPoul-Henning Kampsomeone for some reason wanted to mount IBM MVS diskpacks, a class
9727c74787SPoul-Henning Kamprecognizing and configuring their VTOC information would be a trivial
9827c74787SPoul-Henning Kampmatter.
9927c74787SPoul-Henning Kamp.It
10078ad5421SRuslan Ermilov.Nm
10178ad5421SRuslan Ermilovis topologically agnostic.
1025203edcdSRuslan ErmilovMost volume management implementations
10327c74787SPoul-Henning Kamphave very strict notions of how classes can fit together, very often
10478ad5421SRuslan Ermilovone fixed hierarchy is provided, for instance, subdisk - plex -
10527c74787SPoul-Henning Kampvolume.
10627c74787SPoul-Henning Kamp.El
10727c74787SPoul-Henning Kamp.Pp
10827c74787SPoul-Henning KampBeing extensible means that new transformations are treated no differently
10927c74787SPoul-Henning Kampthan existing transformations.
11027c74787SPoul-Henning Kamp.Pp
11127c74787SPoul-Henning KampFixed hierarchies are bad because they make it impossible to express
11227c74787SPoul-Henning Kampthe intent efficiently.
11378ad5421SRuslan ErmilovIn the fixed hierarchy above, it is not possible to mirror two
11456cf50adSPoul-Henning Kampphysical disks and then partition the mirror into subdisks, instead
11527c74787SPoul-Henning Kampone is forced to make subdisks on the physical volumes and to mirror
11678ad5421SRuslan Ermilovthese two and two, resulting in a much more complex configuration.
11778ad5421SRuslan Ermilov.Nm
11878ad5421SRuslan Ermilovon the other hand does not care in which order things are done,
11927c74787SPoul-Henning Kampthe only restriction is that cycles in the graph will not be allowed.
12078ad5421SRuslan Ermilov.Sh "TERMINOLOGY AND TOPOLOGY"
12178ad5421SRuslan Ermilov.Nm
12278ad5421SRuslan Ermilovis quite object oriented and consequently the terminology
12356cf50adSPoul-Henning Kampborrows a lot of context and semantics from the OO vocabulary:
12427c74787SPoul-Henning Kamp.Pp
12578ad5421SRuslan ErmilovA
12678ad5421SRuslan Ermilov.Dq class ,
12778ad5421SRuslan Ermilovrepresented by the data structure
12878ad5421SRuslan Ermilov.Vt g_class
12978ad5421SRuslan Ermilovimplements one
1305203edcdSRuslan Ermilovparticular kind of transformation.
1315203edcdSRuslan ErmilovTypical examples are MBR disk
13256cf50adSPoul-Henning Kamppartition, BSD disklabel, and RAID5 classes.
13327c74787SPoul-Henning Kamp.Pp
13478ad5421SRuslan ErmilovAn instance of a class is called a
13578ad5421SRuslan Ermilov.Dq geom
13678ad5421SRuslan Ermilovand represented by the data structure
13778ad5421SRuslan Ermilov.Vt g_geom .
13878ad5421SRuslan ErmilovIn a typical i386
13978ad5421SRuslan Ermilov.Fx
14078ad5421SRuslan Ermilovsystem, there
14127c74787SPoul-Henning Kampwill be one geom of class MBR for each disk.
14227c74787SPoul-Henning Kamp.Pp
14378ad5421SRuslan ErmilovA
14478ad5421SRuslan Ermilov.Dq provider ,
14578ad5421SRuslan Ermilovrepresented by the data structure
14678ad5421SRuslan Ermilov.Vt g_provider ,
14778ad5421SRuslan Ermilovis the front gate at which a geom offers service.
14878ad5421SRuslan ErmilovA provider is
14978ad5421SRuslan Ermilov.Do
15078ad5421SRuslan Ermilova disk-like thing which appears in
15178ad5421SRuslan Ermilov.Pa /dev
15278ad5421SRuslan Ermilov.Dc - a logical
15327c74787SPoul-Henning Kampdisk in other words.
15478ad5421SRuslan ErmilovAll providers have three main properties:
15578ad5421SRuslan Ermilov.Dq name ,
15678ad5421SRuslan Ermilov.Dq sectorsize
15778ad5421SRuslan Ermilovand
15878ad5421SRuslan Ermilov.Dq size .
15927c74787SPoul-Henning Kamp.Pp
16078ad5421SRuslan ErmilovA
16178ad5421SRuslan Ermilov.Dq consumer
16278ad5421SRuslan Ermilovis the backdoor through which a geom connects to another
16356cf50adSPoul-Henning Kampgeom provider and through which I/O requests are sent.
16427c74787SPoul-Henning Kamp.Pp
16527c74787SPoul-Henning KampThe topological relationship between these entities are as follows:
16627c74787SPoul-Henning Kamp.Bl -bullet
16727c74787SPoul-Henning Kamp.It
16827c74787SPoul-Henning KampA class has zero or more geom instances.
16927c74787SPoul-Henning Kamp.It
17027c74787SPoul-Henning KampA geom has exactly one class it is derived from.
17127c74787SPoul-Henning Kamp.It
17227c74787SPoul-Henning KampA geom has zero or more consumers.
17327c74787SPoul-Henning Kamp.It
17456cf50adSPoul-Henning KampA geom has zero or more providers.
17527c74787SPoul-Henning Kamp.It
17627c74787SPoul-Henning KampA consumer can be attached to zero or one providers.
17727c74787SPoul-Henning Kamp.It
17827c74787SPoul-Henning KampA provider can have zero or more consumers attached.
17927c74787SPoul-Henning Kamp.El
18027c74787SPoul-Henning Kamp.Pp
18156cf50adSPoul-Henning KampAll geoms have a rank-number assigned, which is used to detect and
1825203edcdSRuslan Ermilovprevent loops in the acyclic directed graph.
1835203edcdSRuslan ErmilovThis rank number is
18427c74787SPoul-Henning Kampassigned as follows:
18527c74787SPoul-Henning Kamp.Bl -enum
18627c74787SPoul-Henning Kamp.It
18778ad5421SRuslan ErmilovA geom with no attached consumers has rank=1.
18827c74787SPoul-Henning Kamp.It
18956cf50adSPoul-Henning KampA geom with attached consumers has a rank one higher than the
19027c74787SPoul-Henning Kamphighest rank of the geoms of the providers its consumers are
19127c74787SPoul-Henning Kampattached to.
19227c74787SPoul-Henning Kamp.El
19357bd0fc6SJens Schweikhardt.Sh "SPECIAL TOPOLOGICAL MANEUVERS"
19456cf50adSPoul-Henning KampIn addition to the straightforward attach, which attaches a consumer
19557bd0fc6SJens Schweikhardtto a provider, and detach, which breaks the bond, a number of special
19657bd0fc6SJens Schweikhardttopological maneuvers exists to facilitate configuration and to
19727c74787SPoul-Henning Kampimprove the overall flexibility.
19878ad5421SRuslan Ermilov.Bl -inset
19978ad5421SRuslan Ermilov.It Em TASTING
20056cf50adSPoul-Henning Kampis a process that happens whenever a new class or new provider
20178ad5421SRuslan Ermilovis created, and it provides the class a chance to automatically configure an
20216e88145SCeri Daviesinstance on providers which it recognizes as its own.
20356cf50adSPoul-Henning KampA typical example is the MBR disk-partition class which will look for
20478ad5421SRuslan Ermilovthe MBR table in the first sector and, if found and validated, will
20527c74787SPoul-Henning Kampinstantiate a geom to multiplex according to the contents of the MBR.
20627c74787SPoul-Henning Kamp.Pp
20756cf50adSPoul-Henning KampA new class will be offered to all existing providers in turn and a new
20827c74787SPoul-Henning Kampprovider will be offered to all classes in turn.
20927c74787SPoul-Henning Kamp.Pp
21027c74787SPoul-Henning KampExactly what a class does to recognize if it should accept the offered
21178ad5421SRuslan Ermilovprovider is not defined by
21278ad5421SRuslan Ermilov.Nm ,
21378ad5421SRuslan Ermilovbut the sensible set of options are:
21427c74787SPoul-Henning Kamp.Bl -bullet
21527c74787SPoul-Henning Kamp.It
21627c74787SPoul-Henning KampExamine specific data structures on the disk.
21727c74787SPoul-Henning Kamp.It
21878ad5421SRuslan ErmilovExamine properties like
21978ad5421SRuslan Ermilov.Dq sectorsize
22078ad5421SRuslan Ermilovor
22178ad5421SRuslan Ermilov.Dq mediasize
22278ad5421SRuslan Ermilovfor the provider.
22327c74787SPoul-Henning Kamp.It
22456cf50adSPoul-Henning KampExamine the rank number of the provider's geom.
22527c74787SPoul-Henning Kamp.It
22656cf50adSPoul-Henning KampExamine the method name of the provider's geom.
22727c74787SPoul-Henning Kamp.El
228a5bebe43SFelix Johnson.Pp
229a5bebe43SFelix JohnsonTasting is controlled by the
230a5bebe43SFelix Johnson.Va kern.geom.notaste
231a5bebe43SFelix Johnsonsysctl.
232a5bebe43SFelix JohnsonTo disable tasting, set the sysctl to 1, to
233a5bebe43SFelix Johnsonre-enable tasting, set the sysctl to 0.
23478ad5421SRuslan Ermilov.It Em ORPHANIZATION
23527c74787SPoul-Henning Kampis the process by which a provider is removed while
23656cf50adSPoul-Henning Kampit potentially is still being used.
23727c74787SPoul-Henning Kamp.Pp
238c1c85751SPoul-Henning KampWhen a geom orphans a provider, all future I/O requests will
23978ad5421SRuslan Ermilov.Dq bounce
24078ad5421SRuslan Ermilovon the provider with an error code set by the geom.
2415203edcdSRuslan ErmilovAny
24227c74787SPoul-Henning Kampconsumers attached to the provider will receive notification about
243c1c85751SPoul-Henning Kampthe orphanization when the event loop gets around to it, and they
244d773aebdSPoul-Henning Kampcan take appropriate action at that time.
24527c74787SPoul-Henning Kamp.Pp
24656cf50adSPoul-Henning KampA geom which came into being as a result of a normal taste operation
24716e88145SCeri Daviesshould self-destruct unless it has a way to keep functioning whilst
24816e88145SCeri Davieslacking the orphaned provider.
24978ad5421SRuslan ErmilovGeoms like disk slicers should therefore self-destruct whereas
25016e88145SCeri DaviesRAID5 or mirror geoms will be able to continue as long as they do
25116e88145SCeri Daviesnot lose quorum.
25227c74787SPoul-Henning Kamp.Pp
253c1c85751SPoul-Henning KampWhen a provider is orphaned, this does not necessarily result in any
254c1c85751SPoul-Henning Kampimmediate change in the topology: any attached consumers are still
255c1c85751SPoul-Henning Kampattached, any opened paths are still open, any outstanding I/O
256c1c85751SPoul-Henning Kamprequests are still outstanding.
25727c74787SPoul-Henning Kamp.Pp
25878ad5421SRuslan ErmilovThe typical scenario is:
25978ad5421SRuslan Ermilov.Pp
260c1c85751SPoul-Henning Kamp.Bl -bullet -offset indent -compact
261c1c85751SPoul-Henning Kamp.It
262c1c85751SPoul-Henning KampA device driver detects a disk has departed and orphans the provider for it.
263c1c85751SPoul-Henning Kamp.It
264c1c85751SPoul-Henning KampThe geoms on top of the disk receive the orphanization event and
26516e88145SCeri Daviesorphan all their providers in turn.
26616e88145SCeri DaviesProviders which are not attached to will typically self-destruct
267c1c85751SPoul-Henning Kampright away.
268c1c85751SPoul-Henning KampThis process continues in a quasi-recursive fashion until all
26916e88145SCeri Daviesrelevant pieces of the tree have heard the bad news.
270c1c85751SPoul-Henning Kamp.It
271c1c85751SPoul-Henning KampEventually the buck stops when it reaches geom_dev at the top
272c1c85751SPoul-Henning Kampof the stack.
273c1c85751SPoul-Henning Kamp.It
27478ad5421SRuslan ErmilovGeom_dev will call
27578ad5421SRuslan Ermilov.Xr destroy_dev 9
27616e88145SCeri Daviesto stop any more requests from
277c1c85751SPoul-Henning Kampcoming in.
27816e88145SCeri DaviesIt will sleep until any and all outstanding I/O requests have
279c1c85751SPoul-Henning Kampbeen returned.
28078ad5421SRuslan ErmilovIt will explicitly close (i.e.: zero the access counts), a change
281c1c85751SPoul-Henning Kampwhich will propagate all the way down through the mesh.
282c1c85751SPoul-Henning KampIt will then detach and destroy its geom.
283c1c85751SPoul-Henning Kamp.It
28456b341a2SEdward Tomasz NapieralaThe geom whose provider is now detached will destroy the provider,
285c1c85751SPoul-Henning Kampdetach and destroy its consumer and destroy its geom.
286c1c85751SPoul-Henning Kamp.It
287c1c85751SPoul-Henning KampThis process percolates all the way down through the mesh, until
288c1c85751SPoul-Henning Kampthe cleanup is complete.
289c1c85751SPoul-Henning Kamp.El
29027c74787SPoul-Henning Kamp.Pp
29156cf50adSPoul-Henning KampWhile this approach seems byzantine, it does provide the maximum
292c1c85751SPoul-Henning Kampflexibility and robustness in handling disappearing devices.
293c1c85751SPoul-Henning Kamp.Pp
29416e88145SCeri DaviesThe one absolutely crucial detail to be aware of is that if the
295c1c85751SPoul-Henning Kampdevice driver does not return all I/O requests, the tree will
296d773aebdSPoul-Henning Kampnot unravel.
29778ad5421SRuslan Ermilov.It Em SPOILING
29827c74787SPoul-Henning Kampis a special case of orphanization used to protect
29927c74787SPoul-Henning Kampagainst stale metadata.
30027c74787SPoul-Henning KampIt is probably easiest to understand spoiling by going through
30127c74787SPoul-Henning Kampan example.
30227c74787SPoul-Henning Kamp.Pp
30378ad5421SRuslan ErmilovImagine a disk,
30416e88145SCeri Davies.Pa da0 ,
30578ad5421SRuslan Ermilovon top of which an MBR geom provides
30678ad5421SRuslan Ermilov.Pa da0s1
30778ad5421SRuslan Ermilovand
30878ad5421SRuslan Ermilov.Pa da0s2 ,
30978ad5421SRuslan Ermilovand on top of
31078ad5421SRuslan Ermilov.Pa da0s1
31178ad5421SRuslan Ermilova BSD geom provides
31278ad5421SRuslan Ermilov.Pa da0s1a
31378ad5421SRuslan Ermilovthrough
31478ad5421SRuslan Ermilov.Pa da0s1e ,
31516e88145SCeri Daviesand that both the MBR and BSD geoms have
31627c74787SPoul-Henning Kampautoconfigured based on data structures on the disk media.
31778ad5421SRuslan ErmilovNow imagine the case where
31878ad5421SRuslan Ermilov.Pa da0
31978ad5421SRuslan Ermilovis opened for writing and those
32078ad5421SRuslan Ermilovdata structures are modified or overwritten: now the geoms would
32127c74787SPoul-Henning Kampbe operating on stale metadata unless some notification system
32227c74787SPoul-Henning Kampcan inform them otherwise.
323d773aebdSPoul-Henning Kamp.Pp
32478ad5421SRuslan ErmilovTo avoid this situation, when the open of
32578ad5421SRuslan Ermilov.Pa da0
32678ad5421SRuslan Ermilovfor write happens,
32716e88145SCeri Daviesall attached consumers are told about this and geoms like
32878ad5421SRuslan ErmilovMBR and BSD will self-destruct as a result.
32978ad5421SRuslan ErmilovWhen
33078ad5421SRuslan Ermilov.Pa da0
33116e88145SCeri Daviesis closed, it will be offered for tasting again
33216e88145SCeri Daviesand, if the data structures for MBR and BSD are still there, new
33327c74787SPoul-Henning Kampgeoms will instantiate themselves anew.
33427c74787SPoul-Henning Kamp.Pp
33527c74787SPoul-Henning KampNow for the fine print:
33627c74787SPoul-Henning Kamp.Pp
33727c74787SPoul-Henning KampIf any of the paths through the MBR or BSD module were open, they
33816e88145SCeri Davieswould have opened downwards with an exclusive bit thus rendering it
33978ad5421SRuslan Ermilovimpossible to open
34078ad5421SRuslan Ermilov.Pa da0
34116e88145SCeri Daviesfor writing in that case.
34216e88145SCeri DaviesConversely,
34327c74787SPoul-Henning Kampthe requested exclusive bit would render it impossible to open a
34478ad5421SRuslan Ermilovpath through the MBR geom while
34578ad5421SRuslan Ermilov.Pa da0
34678ad5421SRuslan Ermilovis open for writing.
34727c74787SPoul-Henning Kamp.Pp
34827c74787SPoul-Henning KampFrom this it also follows that changing the size of open geoms can
349d773aebdSPoul-Henning Kamponly be done with their cooperation.
35027c74787SPoul-Henning Kamp.Pp
35127c74787SPoul-Henning KampFinally: the spoiling only happens when the write count goes from
35216e88145SCeri Davieszero to non-zero and the retasting happens only when the write count goes
353d773aebdSPoul-Henning Kampfrom non-zero to zero.
35478ad5421SRuslan Ermilov.It Em CONFIGURE
35527c74787SPoul-Henning Kampis the process where the administrator issues instructions
3565203edcdSRuslan Ermilovfor a particular class to instantiate itself.
3575203edcdSRuslan ErmilovThere are multiple
35816e88145SCeri Daviesways to express intent in this case - a particular provider may be
35916e88145SCeri Daviesspecified with a level of override forcing, for instance, a BSD
36027c74787SPoul-Henning Kampdisklabel module to attach to a provider which was not found palatable
36127c74787SPoul-Henning Kampduring the TASTE operation.
36227c74787SPoul-Henning Kamp.Pp
36316e88145SCeri DaviesFinally, I/O is the reason we even do this: it concerns itself with
36427c74787SPoul-Henning Kampsending I/O requests through the graph.
36516e88145SCeri Davies.It Em "I/O REQUESTS" ,
36678ad5421SRuslan Ermilovrepresented by
36778ad5421SRuslan Ermilov.Vt "struct bio" ,
36878ad5421SRuslan Ermilovoriginate at a consumer,
36916e88145SCeri Daviesare scheduled on its attached provider and, when processed, are returned
37027c74787SPoul-Henning Kampto the consumer.
37178ad5421SRuslan ErmilovIt is important to realize that the
37278ad5421SRuslan Ermilov.Vt "struct bio"
37378ad5421SRuslan Ermilovwhich enters through the provider of a particular geom does not
37478ad5421SRuslan Ermilov.Do
37578ad5421SRuslan Ermilovcome out on the other side
37678ad5421SRuslan Ermilov.Dc .
37727c74787SPoul-Henning KampEven simple transformations like MBR and BSD will clone the
37878ad5421SRuslan Ermilov.Vt "struct bio" ,
37978ad5421SRuslan Ermilovmodify the clone, and schedule the clone on their
38027c74787SPoul-Henning Kampown consumer.
38178ad5421SRuslan ErmilovNote that cloning the
38278ad5421SRuslan Ermilov.Vt "struct bio"
38378ad5421SRuslan Ermilovdoes not involve cloning the
38478ad5421SRuslan Ermilovactual data area specified in the I/O request.
38527c74787SPoul-Henning Kamp.Pp
38678ad5421SRuslan ErmilovIn total, four different I/O requests exist in
38778ad5421SRuslan Ermilov.Nm :
38878ad5421SRuslan Ermilovread, write, delete, and
38978ad5421SRuslan Ermilov.Dq "get attribute".
39027c74787SPoul-Henning Kamp.Pp
39156cf50adSPoul-Henning KampRead and write are self explanatory.
39227c74787SPoul-Henning Kamp.Pp
39327c74787SPoul-Henning KampDelete indicates that a certain range of data is no longer used
39427c74787SPoul-Henning Kampand that it can be erased or freed as the underlying technology
39527c74787SPoul-Henning Kampsupports.
39627c74787SPoul-Henning KampTechnologies like flash adaptation layers can arrange to erase
39727c74787SPoul-Henning Kampthe relevant blocks before they will become reassigned and
39856cf50adSPoul-Henning Kampcryptographic devices may want to fill random bits into the
39927c74787SPoul-Henning Kamprange to reduce the amount of data available for attack.
40027c74787SPoul-Henning Kamp.Pp
40127c74787SPoul-Henning KampIt is important to recognize that a delete indication is not a
40227c74787SPoul-Henning Kamprequest and consequently there is no guarantee that the data actually
40327c74787SPoul-Henning Kampwill be erased or made unavailable unless guaranteed by specific
4045203edcdSRuslan Ermilovgeoms in the graph.
40578ad5421SRuslan ErmilovIf
40678ad5421SRuslan Ermilov.Dq "secure delete"
40778ad5421SRuslan Ermilovsemantics are required, a
40827c74787SPoul-Henning Kampgeom should be pushed which converts delete indications into (a
40927c74787SPoul-Henning Kampsequence of) write requests.
41027c74787SPoul-Henning Kamp.Pp
41178ad5421SRuslan Ermilov.Dq "Get attribute"
41278ad5421SRuslan Ermilovsupports inspection and manipulation
41327c74787SPoul-Henning Kampof out-of-band attributes on a particular provider or path.
41478ad5421SRuslan ErmilovAttributes are named by
41578ad5421SRuslan Ermilov.Tn ASCII
41678ad5421SRuslan Ermilovstrings and they will be discussed in
41727c74787SPoul-Henning Kampa separate section below.
41878ad5421SRuslan Ermilov.El
41927c74787SPoul-Henning Kamp.Pp
42078ad5421SRuslan Ermilov(Stay tuned while the author rests his brain and fingers: more to come.)
421ba3eb872SScott Long.Sh DIAGNOSTICS
42278ad5421SRuslan ErmilovSeveral flags are provided for tracing
42378ad5421SRuslan Ermilov.Nm
42478ad5421SRuslan Ermilovoperations and unlocking
425ba3eb872SScott Longprotection mechanisms via the
426ba3eb872SScott Long.Va kern.geom.debugflags
427ba3eb872SScott Longsysctl.
428ba3eb872SScott LongAll of these flags are off by default, and great care should be taken in
429ba3eb872SScott Longturning them on.
43078ad5421SRuslan Ermilov.Bl -tag -width indent
4314f068961SRuslan Ermilov.It 0x01 Pq Dv G_T_TOPOLOGY
432ba3eb872SScott LongProvide tracing of topology change events.
4334f068961SRuslan Ermilov.It 0x02 Pq Dv G_T_BIO
434ba3eb872SScott LongProvide tracing of buffer I/O requests.
4354f068961SRuslan Ermilov.It 0x04 Pq Dv G_T_ACCESS
436ba3eb872SScott LongProvide tracing of access check controls.
437ba3eb872SScott Long.It 0x08 (unused)
438ba3eb872SScott Long.It 0x10 (allow foot shooting)
439ba3eb872SScott LongAllow writing to Rank 1 providers.
440ba3eb872SScott LongThis would, for example, allow the super-user to overwrite the MBR on the root
4414f068961SRuslan Ermilovdisk or write random sectors elsewhere to a mounted disk.
4424f068961SRuslan ErmilovThe implications are obvious.
4434f068961SRuslan Ermilov.It 0x40 Pq Dv G_F_DISKIOCTL
4448a3dce33SCeri DaviesThis is unused at this time.
4454f068961SRuslan Ermilov.It 0x80 Pq Dv G_F_CTLDUMP
446ba3eb872SScott LongDump contents of gctl requests.
447ba3eb872SScott Long.El
44856b341a2SEdward Tomasz Napierala.Sh SEE ALSO
449a7c13cccSEdward Tomasz Napierala.Xr libgeom 3 ,
450e5bc2547STom Hukins.Xr geom 8 ,
45156b341a2SEdward Tomasz Napierala.Xr DECLARE_GEOM_CLASS 9 ,
452923544aaSBaptiste Daroussin.Xr disk 9 ,
45356b341a2SEdward Tomasz Napierala.Xr g_access 9 ,
45456b341a2SEdward Tomasz Napierala.Xr g_attach 9 ,
45556b341a2SEdward Tomasz Napierala.Xr g_bio 9 ,
45656b341a2SEdward Tomasz Napierala.Xr g_consumer 9 ,
45756b341a2SEdward Tomasz Napierala.Xr g_data 9 ,
45856b341a2SEdward Tomasz Napierala.Xr g_event 9 ,
45956b341a2SEdward Tomasz Napierala.Xr g_geom 9 ,
46056b341a2SEdward Tomasz Napierala.Xr g_provider 9 ,
46156b341a2SEdward Tomasz Napierala.Xr g_provider_by_name 9
46227c74787SPoul-Henning Kamp.Sh HISTORY
463ac8e5d02SConrad MeyerThis software was initially developed for the
46478ad5421SRuslan Ermilov.Fx
46578ad5421SRuslan ErmilovProject by
46678ad5421SRuslan Ermilov.An Poul-Henning Kamp
4674f068961SRuslan Ermilovand NAI Labs, the Security Research Division of Network Associates, Inc.\&
46878ad5421SRuslan Ermilovunder DARPA/SPAWAR contract N66001-01-C-8035
46978ad5421SRuslan Ermilov.Pq Dq CBOSS ,
47078ad5421SRuslan Ermilovas part of the
47127c74787SPoul-Henning KampDARPA CHATS research program.
47227c74787SPoul-Henning Kamp.Pp
473ac8e5d02SConrad MeyerThe following obsolete
47478ad5421SRuslan Ermilov.Nm
475ac8e5d02SConrad Meyercomponents were removed in
476ac8e5d02SConrad Meyer.Fx 13.0 :
477ac8e5d02SConrad Meyer.Bl -bullet -offset indent -compact
478ac8e5d02SConrad Meyer.It
479ac8e5d02SConrad Meyer.Cd GEOM_BSD ,
480ac8e5d02SConrad Meyer.It
481ac8e5d02SConrad Meyer.Cd GEOM_FOX ,
482ac8e5d02SConrad Meyer.It
483ac8e5d02SConrad Meyer.Cd GEOM_MBR ,
484ac8e5d02SConrad Meyer.It
485ac8e5d02SConrad Meyer.Cd GEOM_SUNLABEL ,
486ac8e5d02SConrad Meyerand
487ac8e5d02SConrad Meyer.It
488ac8e5d02SConrad Meyer.Cd GEOM_VOL .
489ac8e5d02SConrad Meyer.El
490ac8e5d02SConrad Meyer.Pp
491ac8e5d02SConrad MeyerUse
492ac8e5d02SConrad Meyer.Bl -bullet -offset indent -compact
493ac8e5d02SConrad Meyer.It
494ac8e5d02SConrad Meyer.Cd GEOM_PART_BSD ,
495ac8e5d02SConrad Meyer.It
496ac8e5d02SConrad Meyer.Cd GEOM_MULTIPATH ,
497ac8e5d02SConrad Meyer.It
498ac8e5d02SConrad Meyer.Cd GEOM_PART_MBR ,
499ac8e5d02SConrad Meyerand
500ac8e5d02SConrad Meyer.It
501ac8e5d02SConrad Meyer.Cd GEOM_LABEL
502ac8e5d02SConrad Meyer.El
503ac8e5d02SConrad Meyeroptions, respectively, instead.
50427c74787SPoul-Henning Kamp.Sh AUTHORS
5056c899950SBaptiste Daroussin.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org
506