From owner-freebsd-questions@FreeBSD.ORG Sun Jan 16 22:15:05 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6EC7416A4CE for ; Sun, 16 Jan 2005 22:15:05 +0000 (GMT) Received: from chello084114137224.1.15.vie.surfer.at (chello084114137224.1.15.vie.surfer.at [84.114.137.224]) by mx1.FreeBSD.org (Postfix) with SMTP id EA1FB43D48 for ; Sun, 16 Jan 2005 22:15:03 +0000 (GMT) (envelope-from 4711@chello.at) Received: (qmail 4278 invoked from network); 16 Jan 2005 22:15:02 -0000 Received: from matrix010.matrix.net (192.168.123.10) by ns.matrix.net with SMTP; 16 Jan 2005 22:15:02 -0000 From: Christian Hiris <4711@chello.at> To: freebsd-questions@freebsd.org Date: Sun, 16 Jan 2005 23:14:48 +0100 User-Agent: KMail/1.7 References: <20050116201414.GA76014@polands.org> In-Reply-To: <20050116201414.GA76014@polands.org> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200501162315.01954.4711@chello.at> Subject: Re: gmirror: replacing failed disks X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Jan 2005 22:15:05 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday 16 January 2005 21:14, Doug Poland wrote: > Hello, > > I've got a bootable gmirror running on identical SATA drives on > 5.3-STABLE. The technique I've used to build the gmirror can be found > on http://people.freebsd.org/~rse/gmirror, under the heading "GEOM > mirror Approach 2: Single Slice, Preferred, More Flexible". Now I'd > like to experiment with replacing a "failed" drive. This particular box > has hot-swappable drives, so all I need to do is pull a drive out while > the box is running. > > The man page states: > > One disk failed. Replace it with a brand new one: > > gmirror forget data > gmirror insert data da1 > > (My system has a provider gm0s1 with ad4 and ad6 as consumers, so I'll > use those device names) > > Simulate ad4 failing: > > pull the drive > put the drive back in, reboot if necessary to detect drive After you put the drive in, you can try to attach or reinit the controller channel where it's connected to with the command 'atacontrol'. If you put the same drive in, and you haven't zeroed the bootblocks and the slicetable (on ad4) geom will recognice that the missing disk has been re-attached and will start rebuilding. If you want to simulate insertion of a blank disk, run the 'gmirror forget' command before you re-attach disk ad4. Then dd the first few blocks and the last sector of the old slice, where the gmirror metadata are stored. You can do this by 'dd if=/dev/zero of=/dev/ad4 bs=512 count=1 skip=n', where n=number of sectors to be skipped. In your case it's better, if you check where the metadata are stored. Maybe they are stored at the end of your disk. I think of this because of your gmirror list output, where ad4 and ad6 are listed as consumers. > # gmirror forget gm0s1 > # dd if=/dev/zero of=/dev/ad4 bs=512 count=79 You are missing the "&&" operator here. > # size=`fdisk ad6 | grep ', size ' | head -1 | sed -e 's;^.*size > \([0-9]*\).*$;\1;'` && (echo "p 1 165 63 $size"; echo "a 1") | fdisk -v -B ^^ > -f- -i /dev/ad4 > OR > # fdisk -v -B -I /dev/ad4 > > # gmirror insert gm0s1 /dev/ad4s1 > > (Now wait two hours for the drives synchronize) > > That should work, yes? How does gmirror know about /dev/ad4s1 if that > drive was previously unformatted or brand new? That should work, if you create the slice with 'fdisk -v -B -I /dev/ad4', but on the other hand, it would be very interresting, if gmirror really handles the consumers as they are displayed by your gmirror list command. I would blank disk ad4 (as I described above) and see what happens when you issue the command 'gmirror insert gm0s1 /dev/ad4'. Maybe gmirror handles drives with one slice that covers the whole drive, as disks (instead of slices)? I would give it a try. (If you try this, please could you post or pm me the 'gmirror list' output? Thank you!) Cheers, ch - -- Christian Hiris <4711@chello.at> | OpenPGP KeyID 0x3BCA53BE OpenPGP-Key at hkp://wwwkeys.eu.pgp.net and http://pgp.mit.edu -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFB6udl09WjGjvKU74RAsVAAJ4sDZKZ8qZqxVf927yQXBxK7HO/ZwCfdWnL OWuuqs6UMMjwaK/1E9Ewm/o= =0IXG -----END PGP SIGNATURE-----