From owner-freebsd-geom@FreeBSD.ORG Mon Oct 1 13:03:26 2012 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8829D106566B for ; Mon, 1 Oct 2012 13:03:26 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 296D68FC15 for ; Mon, 1 Oct 2012 13:03:25 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.5/8.14.5) with ESMTP id q91D3IrF094010; Mon, 1 Oct 2012 07:03:18 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.5/8.14.5/Submit) with ESMTP id q91D3I4r094007; Mon, 1 Oct 2012 07:03:18 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Mon, 1 Oct 2012 07:03:18 -0600 (MDT) From: Warren Block To: Konstantin Kukushkin In-Reply-To: <50696C20.3020704@rambler-co.ru> Message-ID: References: <50663866.9070001@delphij.net> <50696C20.3020704@rambler-co.ru> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Mon, 01 Oct 2012 07:03:19 -0600 (MDT) Cc: d@delphij.net, freebsd-geom@freebsd.org Subject: Re: Simple way to clear arbitrary drive metadata? X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2012 13:03:26 -0000 On Mon, 1 Oct 2012, Konstantin Kukushkin wrote: >> gmirror is a problem. If the gmirror kernel module is loaded, drives >> with gmirror metadata create a mirror. GEOM prevents writes to the >> drive then. sysctl kern.geom.debugflags=16 allows writes, but the >> mirror is still in memory and running. 'gmirror stop' (which the system >> also does on shutdown) helpfully writes the whole metadata block back to >> the drive. After reboot, it's right back where it was. >> >> Seems like the only way to deal with gmirror is to have the user check >> for it directly, and stop the mirror if the attached drive is a member. > > You may use 'geom clear' command to clear metadata from > disk/partition/other GEOM provider. This will work only on stopped mirrors or > while geom_mirror not loaded, of course. > For gmirror you can 'remove' component from running mirror (even if the > component is last). Metadata will cleared after removing, so gmirror remove > ' is very usable. Yes, that's what I used. This was initially for an update to the gmirror section of the GEOM chapter of the Handbook: http://www.wonkity.com/~wblock/gmirror/geom-mirror.html The problem with gmirror remove or clear is that the user must check to see whether the drive is part of an active mirror to know which command to use. Seems like "remove" should not require the mirror name and would work whether the mirror was active or not. > You can determine what GEOMs metadata living on disk $disk using command > 'geom dump', like this: > for class in mirror stripe concat raid3; do > geom $class dump $disk > done Is there a utility that can do that in the other direction? Given a disk, identify the type of metadata on it?