Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Jan 2005 23:14:48 +0100
From:      Christian Hiris <4711@chello.at>
To:        freebsd-questions@freebsd.org
Subject:   Re: gmirror: replacing failed disks
Message-ID:  <200501162315.01954.4711@chello.at>
In-Reply-To: <20050116201414.GA76014@polands.org>
References:  <20050116201414.GA76014@polands.org>

next in thread | previous in thread | raw e-mail | index | archive | help
-----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-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501162315.01954.4711>