gmirror: replacing failed disks
4711 at chello.at
Sun Jan 16 14:15:05 PST 2005
-----BEGIN PGP SIGNED MESSAGE-----
On Sunday 16 January 2005 21:14, Doug Poland wrote:
> 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
> # 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!)
Christian Hiris <4711 at 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)
-----END PGP SIGNATURE-----
More information about the freebsd-questions