Solved gmirror and single user mode

Hi,
I was reading the great book "FreeBSD: ZFS Mastery".
Chapter 5 reports that, in case of typo in rc.conf, one needs to boot in single user mode, fix error, and reboot. This will cause gmirrorto start resyncing the array.
...probably it's my lack of knowleage of UFS, but: just one disk is functional in single user mode?
Thank you
 
If you wanted to you could build the module into the kernel. Then it would see the array in single user mode.
If you look at /usr/src/sys/amd64/conf/GENERIC you will see only 3 GEOM modules are built into the kernel.
Code:
options     GEOM_PART_GPT        # GUID Partition Tables.
options     GEOM_RAID            # Soft RAID functionality.
options     GEOM_LABEL            # Provides labelization
You could easily add GEOM_MIRROR here and build a custom kernel.
 
That means geom_mirror module is not loaded in single user mode.
To expand on this, the <geom_mirror_load="YES"> setting in /boot/loader.conf enables the module in /boot/kernel/ named geom_mirror.ko to load on boot.
In single mode that does not happen. Think of it as rescue mode.

If geom_mirror was built into the kernel it would not be needed in /etc/rc.conf

You could probably do the same with ZFS and build it into the kernel.
 
just one disk is functional in single user mode?
Actually that is not correct. The two disk nodes in /dev/ will be present. For example /dev/ada0 and /dev/ada1
What is not present is the array in /dev/mirror/

One last note. You can dynamically load the module and mirror from Single User Mode.
kldload geom_mirror
Then you can do any maintenance needed.
 
So a valid question now is: Which of the two mirror disks /etc/rc.conf do I edit when you have a typo in it.
Since you could mount and modify both disks.
You really need to load the geom_mirror module then mount and edit the mirror.
 
Because gmirror re-syncs automatically you have to take care inserting disks into your system.
If you have a degraded gmirror it will automatically rebuild itself using the next disk it finds inserted.
This could be bad in certain cases.

What I like to do is use gmirror to make a back up solution. I use 3 disks for a gmirror and pull one out to sit on a shelf.
Every once in a while I swap a disk to keep them wearing equally and to make sure the mirror is working.
I like having a cold gmirror disk in storage.
 
A little off topic but I think you can have better control over the mirror rebuild by using something like...

gmirror forget {disk-not-synced}
gmirror insert {disk-not-synced}


So make your changes to the disk you designate the master and then clone across to the disk you know doesn't contain those changes.

source: //www.freebsddiary.org/gmirror-failure.php
 
Back
Top