Step 1: Setup The Partitions
Once inside the shell here are the commands to setup GPT and slice up both disks. These examples assume you are doing this on disk 'ada0' and 'ada1' (SATA), if you are using SCSI you'd do da0, da1:
# ---- Setup 1st disk
#
gpart create -s gpt da0
gpart add -s 64k -t freebsd-boot -l boot0 da0
gpart add -s 8G -t freebsd-swap -l swap0 da0
gpart add -t freebsd-ufs -l disk00 da0
# -- Install boot code to first disk
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 da0
# ---- Setup 2nd disk
#
gpart create -s gpt da1
gpart add -s 64k -t freebsd-boot -l boot1 da1
gpart add -s 8G -t freebsd-swap -l swap1 da1
gpart add -t freebsd-ufs -l disk02 da1
# -- Install boot code to 2nd disk
gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada1
**note: continue to all harddisk as above example
[root@nas-master ~]# gpart add -t freebsd-ufs -l disk00/1/2/3/ da0/1/2/3
[root@nas-master ~]# gpart show -l
=> 63 15131573 da4 MBR (7.2G)
63 771057 1 (null) [active] (376M)
771120 6538455 2 (null) (3.1G)
7309575 7807590 3 (null) (3.7G)
15117165 14471 - free - (7.1M)
=> 0 771057 da4s1 BSD (376M)
0 65 - free - (32k)
65 770944 1 (null) (376M)
771009 48 - free - (24k)
=> 0 6538455 da4s2 BSD (3.1G)
0 16 - free - (8.0k)
16 6538432 1 (null) (3.1G)
6538448 7 - free - (3.5k)
=> 34 585871897 da0 GPT (279G)
34 585871897 1 disk00 (279G)
=> 34 585871897 da1 GPT (279G)
34 585871897 1 disk01 (279G)
=> 34 3906963565 da2 GPT (1.8T)
34 3906963565 1 disk02 (1.8T)
=> 34 3906963565 da3 GPT (1.8T)
34 3906963565 1 disk03 (1.8T)
Step 2: Setup The Gmirror ProvidersBefore we proceed we need to have GEOM "re-taste" the partitions so our nice labels show up in /dev/gpt/:
[root@nas-master ~]# true > /dev/da0/1/2/3
# You can check to make sure this worked by running:
[root@nas-master ~]# ls -l /dev/gpt/total 0
crw-r----- 1 root operator 0, 171 Mar 11 03:33 disk00
crw-r----- 1 root operator 0, 132 Mar 11 03:33 disk01
crw-r----- 1 root operator 0, 140 Mar 11 03:34 disk02
crw-r----- 1 root operator 0, 161 Mar 11 03:34 disk03
Now we can continue to build the mirror providers for each of our partitions:
# -- Build gmirrors
[root@nas-master ~]# gmirror label disk00 /dev/gpt/disk00 /dev/gpt/disk01
[root@nas-master ~]# gmirror label disk02 /dev/gpt/disk02 /dev/gpt/disk03
# -- Load the geo_mirror KLD
[root@nas-master ~]# kldload geom_mirror
# -- Check status
[root@nas-master ~]# gmirror status
Name Status Components
mirror/disk02 COMPLETE gpt/disk03 (ACTIVE)
gpt/disk02 (ACTIVE)
mirror/disk00 COMPLETE gpt/disk01 (ACTIVE)
gpt/disk00 (ACTIVE)
Step 3: Create And Mount The Root (/) Filesystem
Here
we actually format the root filesystem, enabling soft updates (-U). I
also use "-L disk" to set the filesystem label but this isn't needed.
Then we mount the new filesystem in /mnt (which is where the installer
expects the target filesystem to be).
[root@nas-master ~]# newfs -U -L disk00 /dev/mirror/disk00
[root@nas-master ~]# newfs -U -L disk02 /dev/mirror/disk02
[root@nas-master ~]# mount /dev/mirror/disk00 /mnt[root@nas-master ~]# mount /dev/mirror/disk02 /mnt02
now need to create the fstab file which will be put into place by the installer
# Device Mountpoint FStype Options Dump Pass#
/dev/mirror/disk00 / ufs rw 1 1
/dev/mirror/disk02 / ufs rw 1 1
Step 4: Final Configuration
# -- Make sure gmirror module comes up on boot
[root@nas-master ~]# echo 'geom_mirror_load="YES"' >> /boot/loader.conf