I think I read a while ago that this (entry in loader.conf) loads the gmirror module either before or very early on during the kernel boot cycle (this could be completely fabricated) to ensure the root filesystem on the gmirror is available when things need it.

At the moment this loads the kernel module.

However if I build gmirror into the kernel staticly I have no idea when it's initialised and so - will my system still boot? Or will the gmirror code not have been initialised by the time it's needed?

This could be a stupid or academic question but the box in question is on the end of an ssh connection so trial and error would be unwise

/boot/loader is loaded off a single disk. This loads the kernel, off the same disk. The kernel enables gmirror support. The rest of the OS is loaded off the mirror.

When using modules, it works the same way. /boot/loader is loaded off a single disk. The gmirror module is loaded off the same disk. The kernel is loaded off the same disk. The kernel then enables gmirror support. And the rest of the OS is loaded off the mirror.

You only boot off a single disk. If that disk dies, you can't boot until you configure the other disk as the boot drive. That's the one downside to using software RAID. You aren't protected until the kernel has loaded, and the OS is booted. Until then, you are running off a single disk.

/boot/loader is loaded off a single disk. This loads the kernel, off the same disk. The kernel enables gmirror support. The rest of the OS is loaded off the mirror.

When using modules, it works the same way. /boot/loader is loaded off a single disk. The gmirror module is loaded off the same disk. The kernel is loaded off the same disk. The kernel then enables gmirror support. And the rest of the OS is loaded off the mirror.

You only boot off a single disk. If that disk dies, you can't boot until you configure the other disk as the boot drive. That's the one downside to using software RAID. You aren't protected until the kernel has loaded, and the OS is booted. Until then, you are running off a single disk.

Thanks - that answers my kernel / module question

I didn't know that - I thought gmirror handled the boot sector as well - which I guess is a little naive when you actually think about it.

Do you have any resources on how to boot the other disk in the mirror should the above scenario happen?

Where adX is replaced with the correct device name for your harddrive. That will install the boot code into sector 0 of that harddrive. You want to do that for all the other drives in your mirror set (the primary drive already has it, obviously). That will enable the other drives to be used as boot drives.

Since the device names will be different, you will need to either:
* create a /boot.config file with the correct settings, or
* manually enter the correct settings at the boot: prompt when it fails

/boot.config is used/read before /boot/loader is run. It's part of the boot loader.

See the man page for all the details.

You want to create this on the mirror. Then if a drive dies, you can just edit it to point to the other drive, and it should survive a reboot. Worked on my home machine with a three-drive gmirror setup, before I moved over to using a USB flash drive to boot from.