Broken gmirror: why /dev/ufs is empty when geom_mirror is not loaded?

Ivan Voras ivoras at freebsd.org
Mon Jan 17 13:18:07 UTC 2011


On 13/01/2011 16:24, Lev Serebryakov wrote:
> Hello, Freebsd-geom.
>
>
>    I have mirrored PARTITION (/dev/ad4s1d + /dev/ad6s1d) with UFS with
> label on it. This label is shown in /dev/ufs when geom_mirror is
> loaded.
>
>    When geom_mirror is NOT loaded both ad4s1d and ad6s1d are valid,
> complete, clean filesystems, but here is no /dev/ufs entries for them,
> and kernel can not mount FSes at all.

It's because glabel checks file system size information in the UFS and 
doesn't create the label if it doesn't match.

  88                 } else if (fs->fs_magic == FS_UFS2_MAGIC && 
fs->fs_fsize > 0 &&
  89                     pp->mediasize / fs->fs_fsize == fs->fs_size) {
  90                         /* Valid UFS2. */
  91                 } else {

It was done to try and prevent exactly the problem you describe - the 
abuse of nested GEOM devices. In this case, gmirror takes one sector 
from the device and so the UFS metadata size doesn't match device size 
if it's looked at from outside gmirror. mount(8) doesn't check this so 
you can mount the device from outside gmirror.

>    Is it because two filesystems have the same label? How this
> situation should be solved to allow system boot with broken mirror?

"Broken mirror" means /dev/mirror/something will still be visible but it 
will be backed by only one physical device. It does not usually mean 
"gmirror metadata is broken" because it can trivially be recreated.



More information about the freebsd-geom mailing list