gmirror: replacing failed disks

Doug Poland doug at
Sun Jan 16 12:14:17 PST 2005


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, 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

# gmirror forget gm0s1
# dd if=/dev/zero of=/dev/ad4 bs=512 count=79

# 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?


More information about the freebsd-questions mailing list