[afnog] G Mirror Configuration

Musa.E.A.Kijera mkijera at qanet.gm
Mon Aug 22 15:10:59 EAT 2005


Below is the configuration that I used.


    Booting into the LiveCD filesystem

Reboot from the Install CD (FreeBSD 5.4 or above) or from Install CD 
disc2 (FreeBSD 5.3), and enter Fixit mode. Then get the root filesystem 
and devfs running:

# *chroot /dist*
# *mount_devfs devfs /dev*

[edit 
<http://freebsdwiki.net/index.php?title=RAID1%2C_Software%2C_How_to_setup&action=edit&section=4>]


    Preparing to Create a Mirror

Before we get started with the actual mirror procedures, we'll make sure 
the GEOM module is loaded:

# *gmirror load*

Next, make ABSOLUTELY CERTAIN that you don't have any pre-existing GEOM 
module labels written to either of your drives - because if you do (for 
instance from having futzed about with this before finding this article, 
or trying the article once and then trying it again) it will prevent 
other things from working. So, clean off any preexisting metadata from 
each drive:

# *gmirror clear /dev/ad0*
# *gmirror clear /dev/ad2*

[edit 
<http://freebsdwiki.net/index.php?title=RAID1%2C_Software%2C_How_to_setup&action=edit&section=5>]


    Creating and Initializing the Mirror

Now that we've got that sorted out, you've got a decision to make - do 
you want your new mirror to use round-robin device balancing, or 
load-based? (*Split* balancing is also available, but is beyond the 
scope of this article. *man gmirror* for details.)

Round-robin balancing simply makes each successive data access request 
to the next component in the mirror since the last one, whereas 
load-based tries to intelligently send data access requests to the least 
loaded component in the mirror. I'm going to assume you want *load* 
balancing, but if you prefer *round-robin*, simply substitute that in 
the label command below.

# *gmirror label -v -b load gm0 /dev/ad0*
# *mount /dev/mirror/gm0s1a /mnt*

And we've created and mounted our mirror filesystem, currently with a 
single physical drive in it - our existing system drive.

[edit 
<http://freebsdwiki.net/index.php?title=RAID1%2C_Software%2C_How_to_setup&action=edit&section=6>]


    Reconfiguring the System

Now it's time to set things up so that we can boot the system to the 
GEOM mirror itself, not to /dev/ad0 directly. The next two commands will 
make sure that the GEOM module will load automatically at boot time, and 
tell the system that the swap file will be on a mirror, not a raw drive.

# *echo geom_mirror_load="YES" >> /mnt/boot/loader.conf*
# *echo swapoff="YES" >> /mnt/etc/rc.conf*

Now we need to fix fstab to refer to the mirror, not to /dev/ad0 itself. 
You can either manually edit it using ee 
<http://freebsdwiki.net/index.php/Ee> or vi 
<http://freebsdwiki.net/index.php/Vi> and change all references to 
/dev/ad0? to /dev/mirror/gm0? - ie /dev/ad0s1b becomes 
/dev/mirror/gm0s1b - or you can use a sed 
<http://freebsdwiki.net/index.php/Sed> command to do it for you:

# *sed "s%ad0%mirror/gm0%" /mnt/etc/fstab > /mnt/etc/fstab.new*
# *mv /mnt/etc/fstab /mnt/etc/fstab.old*
# *mv /mnt/etc/fstab.new /mnt/etc/fstab*

And now we're ready to reboot! So pull the live CD out of the drive, 
issue a *shutdown -r now*, and you should come back up nicely with 
everything just as it was.

[edit 
<http://freebsdwiki.net/index.php?title=RAID1%2C_Software%2C_How_to_setup&action=edit&section=7>]


    Adding the New Drive

The only thing left to do now is to add the physical /dev/ad2 device to 
your shiny new /dev/mirror/gm0 mirror.

# *gmirror insert gm0 /dev/ad2*






Phil Regnauld wrote:

>On Mon, Aug 22, 2005 at 09:59:57AM +0000, Musa.E.A.Kijera wrote:
>  
>
>>Did any body had any idea on configuring gmirror on FreeBSD 5.4   using 
>>4 physical disks . It did work fine on 2 disks , one mirrored on the 
>>other one but for some funny reasons it cant work with 2 mirrored on 
>>another two . Is it that it can only work with two disks ..
>>    
>>
>
>	Hi Musa,
>
>	When you say "2 mirrored on another two", do you mean:
>
>disk1   disk2   disk3   disk4
>	\   /           \   /
>	mirror1        mirror2
>		   \       /
>			\     /
>			mirror3
>
>
>	?
>
>	You don't mention your configuration...
>
>	You should be able to create the two mirror devices mirror1 and mirror2
>	as mirror3 (GEOM is that way).
>
>
>
>  
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mkijera.vcf
Type: text/x-vcard
Size: 310 bytes
Desc: not available
Url : http://listserv2.cfi.co.ug/mailman/private/afnog/attachments/20050822/65bb1358/mkijera.vcf


More information about the afnog mailing list