Installing FreeBSD on mirror(gmirror) using livecd

Hello,
Here is my small step-by-step guide, how I installed FreeBSD directly to mirror (gmirror) using live CD. It may be useful to someone.

1. Start from FreeBSD as LiveCD

2. Loag gmirror(8) module:
Code:
# gmirror load


3. Create mirror: (I have only two hard drives )
Code:
 # gmirror label -v gm0 /dev/ada0 /dev/ada1


4. Make MBR partition on mirror device (I decided to use MBR partition because my Asus motherboard does not like too boot from GPT):
Code:
 # gpart create -s MBR mirror/gm0
 # gpart add -t FreeBSD -a 4k mirror/gm0
Ignore "not aligned 4096 bytes" message ... If someone can explain me why system show this warning...

Code:
# gpart show mirror/gm0
=>            63  1953525104 mirror/gm0 MBR (932G) 
              63          63            - free - (32k) 
             126  1953524979          1 freebsd (932G) 
      1953525105          62            - free - (31k)

5. Label mirror
Code:
 # gpart create -s BSD mirror/gm0s1

Add 2G /dev/mirror/gm0s1a which will mount as /
Code:
 #  gpart add -t freebsd-ufs -a 4k -s 2g mirror/gm0s1

Add 4G swap
Code:
#  gpart add -t freebsd-swap -a 4k -s 4g mirror/gm0s1

Add 2G /dev/mirror/gm0s1d mounted as /tmp
Code:
 #  gpart add -t freebsd-ufs -a 4k -s 2g mirror/gm0s1

Add 25G /dev/mirror/gm0s1e mount as /var
Code:
 #  gpart add -t freebsd-ufs -a 4k -s 25g mirror/gm0s1

Add 50G /dev/mirror/gm0s1f mounted as /usr
Code:
#  gpart add -t freebsd-ufs -a 4k -s 50g mirror/gm0s1

Add the /dev/mirror/gm0s1g use the rest space, mounted as /common (I prefer use this extra partition for storing data)
Code:
#  gpart add -t freebsd-ufs -a 4k        mirror/gm0s1

6. Make the mirror bootable by installing bootcode in the MBR and BSDlabel and setting the active slice:
Code:
 # gpart bootcode -b /boot/mbr mirror/gm0
# gpart set -a active -i 1 mirror/gm0
# gpart bootcode -b /boot/boot mirror/gm0s1

7. Format mirror filesystem, enable soft-updates
Code:
# newfs -U /dev/mirror/gm0s1a
# newfs -U /dev/mirror/gm0s1d
# newfs -U /dev/mirror/gm0s1e
# newfs -U /dev/mirror/gm0s1f
# newfs -U /dev/mirror/gm0s1g

-====================================================-
8. Deploy files / Install operating system

Code:
# mount /dev/mirror/gm0s1a /mnt
# mkdir /mnt/tmp
# mkdir /mnt/var
# mkdir /mnt/usr
# mkdir /mnt/common
# mount /dev/mirror/gm0s1d /mnt/tmp
# mount /dev/mirror/gm0s1e /mnt/var
# mount /dev/mirror/gm0s1f /mnt/usr
# mount /dev/mirror/gm0s1g /mnt/common

Install base
Code:
# /usr/bin/tar -xvf /usr/freebsd-dist/base.txz -C /mnt
Install kernel
Code:
# /usr/bin/tar -xvf /usr/freebsd-dist/kernel.txz -C /mnt

Install doc
Code:
# /usr/bin/tar -xvf /usr/freebsd-dist/doc.txz -C /mnt

Install src
Code:
# /usr/bin/tar -xvf /usr/freebsd-dist/src.txz -C /mnt

Load gmirror(8) module at boot
Code:
 # echo geom_mirror_load="YES" >> /mnt/boot/loader.conf

Create /etc/fstab
Code:
# echo "# Device			Mountpoint	FStype	Options Dump	Pass#" > /mnt/etc/fstab
# echo "/dev/mirror/gm0s1a	/			ufs		rw		1		1" >> /mnt/etc/fstab
# echo "/dev/mirror/gm0s1b	none		swap	sw		0		0" >> /mnt/etc/fstab
# echo "/dev/mirror/gm0s1e	/var		ufs		rw		2		2" >> /mnt/etc/fstab
# echo "/dev/mirror/gm0s1d	/tmp		ufs		rw		2		2" >> /mnt/etc/fstab
# echo "/dev/mirror/gm0s1f	/usr		ufs		rw		2		2" >> /mnt/etc/fstab
# echo "/dev/mirror/gm0s1g	/common		ufs		rw		2		2" >> /mnt/etc/fstab

9. Reboot the system

10. Setup timezone using tzsetup(8)
11. change root password: passwd root
12. create user accounts: adduser...
13. modify rc.conf: ee /etc/rc.conf
14. you know the rest :)
 
Back
Top