Date: Fri, 6 Mar 2009 10:29:25 +0300 From: Yuri Pankov <yuri.pankov@gmail.com> To: Peter Steele <psteele@maxiscale.com> Cc: freebsd-questions@freebsd.org Subject: Re: What's the best way to destroy a geom mirror? Message-ID: <20090306072925.GA38402@darklight.homeunix.org> In-Reply-To: <12446074.821236274528605.JavaMail.HALO$@halo> References: <27757053.721236272524668.JavaMail.HALO$@halo> <12446074.821236274528605.JavaMail.HALO$@halo>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 05, 2009 at 09:35:31AM -0800, Peter Steele wrote: > > I've created a USB boot disk that is used to clone itself onto the systems hard drives, setting up mirrored file systems in the process. The main difficulty I'm having is reimaging a system with an existing OS whose drives are already configured in a mirror. I want of course to destroy the mirror and create a complete new one, but I can't find the right process to accomplish this reliably. I am doing the following: > > # Cycle through each /dev/adNN drive and clean it. This has to be > # done before the geom_mirror driver is loaded. > disks=(`ls /dev/ad* | grep -v "s" | sed -e "s|/dev/||" -e "s|ad||" | sort -g`) > for ((i = 0 ; i < ${#disks[@]} ; i++)); do > disk=ad${disks[i]} > dd if=/dev/zero of=/dev/${disk} bs=512 count=79 > done > > # Partition the drives as needed > ... > > # Create the mirror, starting with the first drive in the list > gmdisk=ad${disks[0]} > gmirror load > gmirror label -v -n -b round-robin gm0 ${gmdisk}s1 > > This is where the problem occurs. If there was already a mirrored file system previously active on the system being reimaged, the label operation complains that it can't store the metadata on the indicated drive: > > gmirror: Can't store metadata on ad4s1: Operation not permitted. > > If I make sure the existing mirrors are torn down first by iterating through the drives and doing a "remove" operation, this can solve the problem, but in some cases the mirror is in a suspect state and I've seen the "gmirror load" command hang idefiinitely. So I don't want to do a load command before I destroy the old mirrors, but I can't seem to find a way to reliably destroy the old mirrors. Can anyone suggest a way to do this? Have you tried using 'clear' keyword? HTH, Yuri
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090306072925.GA38402>