Gmirror before Installation

I'm confused how to calculate the number required for the second step ... (it's been a long day)

diskinfo.png
 
It's 238 GiB. To remove all metadata (the first 2 GiB and the last 8 GiB):
Code:
dd if=/dev/zero of=/dev/ada0 bs=1g count=2
dd if=/dev/zero of=/dev/ada0 bs=1g seek=230 count=999999
 
Weird .. the commands ran fine but the partition information still shows the same as before.

Is a reboot required after running the commands?
 
Scratch that .. everything is fine now. I'll try your new method for editing fstab in the morning.

Thanks again for all your help.
 
I expect you figured it out by now, but the disks should not be in use when the metadata are cleared.

You can do it to an unused disk from a running system.

Otherwise you should be booting from USB/DVD, using an installation/emergency shell, and clearing the metadata just prior to rebuilding the mirrors.
 
Ok, after much trial and error I finally got it working.

What I had to do was :

1) Boot from memstick and select "shell".
Code:
gmirror load
gmirror destroy gm0

gmirror label -v gm0 /dev/ada0 /dev/ada1
gpart create -s MBR mirror/gm0
gpart add -t freebsd -a 4k mirror/gm0

gpart create -s BSD mirror/gm0s1
gpart add -t freebsd-swap -a 4k -s 4g -i 2 mirror/gm0s1
gpart add -t freebsd-ufs -a 4k -i 1 mirror/gm0s1

gpart bootcode -b /boot/mbr mirror/gm0
gpart set -a active -i 1 mirror/gm0
gpart bootcode -b /boot/boot mirror/gm0s1

newfs -t -U /dev/mirror/gm0s1a
mount /dev/mirror/gm0s1a /mnt

exit

2) Install the OS

At this point, if you try to access "/mnt" in a shell, it will be empty.

3) Reboot and boot from memstick again and select "shell".
Code:
gmirror load

4) Ignore the "ada0 + ada1 could not be added to mirror" error message.
Code:
mount /dev/mirror/gm0s1a /mnt

5) Edit the necessary files needed for gmirror
Code:
echo 'geom_mirror_load="YES"' >> /mnt/boot/loader.conf

vi /mnt/etc/fstab
/dev/mirror/gm0s1a  /           ufs     rw      1       1
/dev/mirror/gm0s1b  none        swap    sw      0       0

6) Reboot

I hope this helps someone in the future.
 
echo "/dev/mirror/gm0p2 / ufs rw 1 1" >> /tmp/bsdinstall_etc/fstab
echo 'geom_mirror_load="YES"' >> /tmp/bsdinstall_boot/loader.conf
You can skip your step 5 by adding the above lines when you drop to a shell. You will need to change the partition name.
(Instead of dropping to the shell when you boot off the memstick use 'Install' and drop to shell during Disk Partition phase)
/temp/bsdinstall_etc and /temp/bsd_install_boot are inside the chroot and point to the installs /etc and /boot.
 
The FreeBSD installation process has an option to place file systems manually.

So after you have used the initial shell to set up the mirror, and make the file systems, you exit the shell and choose "Install".

Proceed as normal, but choose manual file system partitioning. Assign the partitions that you have created (e.g. gm0s1) to their file systems (e.g. root). You have to use TAB and arrows to navigate (it's quite finnicky, and not terribly intuitive, but will work).

If you do that correctly, /etc/fstab will be created correctly.

Just before the installation completes, take the shell exit offered and fix up /boot/loader.conf
 
Back
Top