correct way to setup gmirror on 7.4?
Michael Proto
mike at jellydonut.org
Wed Apr 27 19:07:18 UTC 2011
I'm migrating away from my old pseudo-RAID partitions to GEOM gmirror
and I have some questions on the right way to accomplish this. I've
got two new 1TB disks that I'm setting up for the new mirror, and
unfortunately they're Western Digital drives with 4k sectors that
report themselves as 512b.
Here's what I'm currently doing to setup this array. The disks are
detected as ad4 and ad6 on my FreeBSD 7.4 server.
# initialize/wipe MBR
dd if=/dev/zero of=/dev/ad4 bs=512 count=79
dd if=/dev/zero of=/dev/ad6 bs=512 count=79
# gpart
gpart create -s gpt ad4
gpart create -s gpt ad6
gpart bootcode -b /boot/pmbr ad4
gpart bootcode -b /boot/pmbr ad6
# add partitions
gpart add -t freebsd-ufs -l raidhome1-2 -b 2048 -s 195330048 ad4
gpart add -t freebsd-ufs -l raidhome2-2 -b 2048 -s 195330048 ad6
gpart add -t freebsd-ufs -l raidvault1-2 -b 195338240 -s 1758167040 ad4
gpart add -t freebsd-ufs -l raidvault2-2 -b 195338240 -s 1758167040 ad6
(I'm using these partition start values because they divide evenly
into 4k blocks. I don't mind wasting a few MB on each disk to have
correctly-aligned partitions)
gpart show ad4
=> 34 1953525101 ad4 GPT (932G)
34 2014 - free - (1.0M)
2048 195330048 1 freebsd-ufs (93G)
195332096 6144 - free - (3.0M)
195338240 1758167040 2 freebsd-ufs (838G)
1953505280 19855 - free - (9.7M)
gpart show ad6
=> 34 1953525101 ad6 GPT (932G)
34 2014 - free - (1.0M)
2048 195330048 1 freebsd-ufs (93G)
195332096 6144 - free - (3.0M)
195338240 1758167040 2 freebsd-ufs (838G)
1953505280 19855 - free - (9.7M)
gmirror label -v -n -b round-robin gm0p1 /dev/ad4p1
newfs -U -b 32768 -f 4096 -S 4096 /dev/mirror/gm0p1
gmirror label -v -n -b round-robin gm0p2 /dev/ad4p2
newfs -U -b 32768 -f 4096 -S 4096 /dev/mirror/gm0p2
(then I mount /dev/mirror/gm0p1 and /dev/mirror/gm0p2 and copy data
from my original array to this new array)
Finally I insert the ad6 disk and wait for the array to sync:
gmirror configure -a gm0p1
gmirror insert gm0p1 /dev/ad6p1
gmirror configure -a gm0p2
gmirror insert gm0p2 /dev/ad6p2
Once the array is synchronized things generally look good, although
after a reboot I did see the following that had me concerned (from
dmesg output):
GEOM: ad4: the primary GPT table is corrupt or invalid.
GEOM: ad4: using the secondary instead -- recovery strongly advised.
Am I using the correct process to create this array? Since I still
have my old array in the system I can rebuild it again if needed, and
would prefer to do it correctly if I'm not already.
Thanks all!
-Proto
More information about the freebsd-stable
mailing list