HOWTO: Install FreeBSD 9.0 over software raid 1 mirror using gpart and gmirror
Boot FreebSD Installation media , Execute shell on Partitioning menu option.
start with my second hdd, cuz the first is already ready, just repeat .
1. Create GPT partitions on the hard disks first
# gpart create -s gpt ada2
# gpart add -s 700G -t freebsd-ufs -l ada2p1 ada2 /first index will be for the jails/
# gpart add -s 64k -t freebsd-boot -l ada2p2 ada2 /the bootcode partition/
# gpart add -s 200G -t freebsd-ufs -l ada2p3 ada2 /root/
# gpart add -s 400M -t freebsd-ufs -l ada2p4 ada2 /boot/
2. Install bootcodes:
# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i2 ada2 /bootcode on ada2 index 2 – bootcode partition/
# gpart bootcode -b /boot/pmbr -p /boot/gptboot -i2 ada1 /bootcode on ada1 index 2 – bootcode partition/
3. Active and check gpts:
# true > /dev/ada1 && true > /dev/ada2 ; ls /dev/gpt/ <- gpts must be here if everything is ok
4. Active and Create geom mirrir a.k.a. gmirror
# kld_load geom_mirror /load geom mirror module/
#gmirror label jails /dev/gpt/ada1p1 /dev/gpt/ada2p1 /jails partition/
#gmirror label bootcode /dev/gpt/ada1p2 /dev/gpt/ada2p2 /bootcode place/
#gmirror label root /dev/gpt/ada1p3 /dev/gpt/ada2p3 /root partition/
#gmirror label boot /dev/gpt/ada1p3 /dev/ada2p4 /boot partition/
5. Create root filesystem and mount it and config fstab in the way the bsdinstaller expects:
# newfs -U /dev/mirror/root
# mount /dev/mirror/root /mnt
# vi /tmp/bsdisntall_etc/fstab >> /dev/root/mirror / ufs rw 1 1
6. Exit to return back to installer and continue to install the system
# exit
7. Execute shell BEFORE installer end and restart the system!!
Put the geoms in the boot loader.conf 🙂
# echo ‘geom_mirror_load=”YES”‘ >> /boot/loader.conf
#echo ‘daily_status_gmirror_enable=”YES”‘ >> /etc/periodic.conf
#exit
That’s it