How to tear down a geom mirror?
psteele at maxiscale.com
Fri Mar 6 11:59:36 PST 2009
Okay, thanks everyone for their feedback. I think I have a workable solution now.
----- Original Message -----
From: "Oliver Fromme" <olli at lurza.secnetix.de>
To: freebsd-hackers at FreeBSD.ORG, psteele at maxiscale.com
Sent: Friday, March 6, 2009 11:15:11 AM GMT -08:00 US/Canada Pacific
Subject: Re: How to tear down a geom mirror?
Peter Steele wrote:
> > Yes. The "clear" commands usually just zero-out the last sector of the
> > underlying provider (doesn't matter if it's a drive, slice or something
> > altogether different) so you don't have to do it manually.
> So, as a generic solution then I could just iterate through all
> slices of all drives and run "gmirror clear" on each, and run dd
> to clear the first sectors. What btw is in these first sectors? I
> use this command because I saw it being done in one of the gmirror
> tutorials. I understand what the gmirror clear command does, but what
> is the dd command clearing?
It clears the MBR (slice table) and GPT or disklabel
(partition table), if any. Depending on how many
sectors you clear, it will also destroy the beginning
the file system, e.g. the first UFS superblock.
By the way, if you cannot use "gmirror clear" for any
reason, you can also easily clear the last sector on
any devices using the information from diskinfo.
set -- $(diskinfo $DEV)
LASTSEC=$(( $MEDIASIZE - 1 ))
dd if=/dev/zero of=$DEV bs=$BLOCKSIZE seek=$(( $MEDIASIZE - 1 )) count=1
That's pretty much what "gmirror clear /dev/ad0s1a" does.
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart
FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd
"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."
-- Robert Firth
More information about the freebsd-hackers