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