summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2014-01-10 07:48:36 +0000
committerae <ae@FreeBSD.org>2014-01-10 07:48:36 +0000
commit2865f87f4a69c49f910445fb5c56eca59e1790ee (patch)
tree964cf2da2e701ff218146655b4ecfec921925442 /sbin
parent5308ec580218db5152159128ab830fcdf297c82d (diff)
downloadFreeBSD-src-2865f87f4a69c49f910445fb5c56eca59e1790ee.zip
FreeBSD-src-2865f87f4a69c49f910445fb5c56eca59e1790ee.tar.gz
MFC r259634:
Prevent users from deactivating the last component of a mirror. MFC r259929: Add an ability to stop gmirror and clear its metadata in one command. This fixes the problem, when gmirror starts again just after stop. The problem occurs when gmirror's component has geom label with equal size. E.g. gpt and gptid have the same size as partition, diskid has the same size as entire disk. When gmirror's geom has been destroyed, glabel creates its providers and this initiate retaste. Now "gmirror destroy" command is available. It destroys geom and also erases gmirror's metadata. PR: 184985
Diffstat (limited to 'sbin')
-rw-r--r--sbin/geom/class/mirror/geom_mirror.c7
-rw-r--r--sbin/geom/class/mirror/gmirror.814
2 files changed, 20 insertions, 1 deletions
diff --git a/sbin/geom/class/mirror/geom_mirror.c b/sbin/geom/class/mirror/geom_mirror.c
index 17cfccb..30f5f84 100644
--- a/sbin/geom/class/mirror/geom_mirror.c
+++ b/sbin/geom/class/mirror/geom_mirror.c
@@ -82,6 +82,13 @@ struct g_command class_commands[] = {
{ "deactivate", G_FLAG_VERBOSE, NULL, G_NULL_OPTS,
"[-v] name prov ..."
},
+ { "destroy", G_FLAG_VERBOSE, NULL,
+ {
+ { 'f', "force", NULL, G_TYPE_BOOL },
+ G_OPT_SENTINEL
+ },
+ "[-fv] name ..."
+ },
{ "dump", 0, mirror_main, G_NULL_OPTS,
"prov ..."
},
diff --git a/sbin/geom/class/mirror/gmirror.8 b/sbin/geom/class/mirror/gmirror.8
index cabeac6..bb48eca 100644
--- a/sbin/geom/class/mirror/gmirror.8
+++ b/sbin/geom/class/mirror/gmirror.8
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 20, 2013
+.Dd December 27, 2013
.Dt GMIRROR 8
.Os
.Sh NAME
@@ -86,6 +86,10 @@
.Ar name
.Ar prov ...
.Nm
+.Cm destroy
+.Op Fl fv
+.Ar name ...
+.Nm
.Cm forget
.Op Fl v
.Ar name ...
@@ -227,6 +231,14 @@ Activate the given component(s), which were marked as inactive before.
.It Cm deactivate
Mark the given component(s) as inactive, so it will not be automatically
connected to the mirror.
+.It Cm destroy
+Stop the given mirror and clear metadata on all its components.
+.Pp
+Additional options include:
+.Bl -tag -width ".Fl f"
+.It Fl f
+Stop the given mirror even if it is opened.
+.El
.It Cm forget
Forget about components which are not connected.
This command is useful when a disk has failed and cannot be reconnected, preventing the
OpenPOWER on IntegriCloud