gmirror gm0 destroyed on shutdown; GPT corrupt

Ivan Voras ivoras at
Sun Jun 28 13:18:38 UTC 2009

2009/6/28 Marcel Moolenaar <xcllnt at>:

> Using the last sector is not only flawed because it creates a race
> condition, it's flawed in the assumption that you can always make
> a geom part of a mirror by storing meta-data on the geom without
> causing corruption. This whole idea of using the last sector was
> so that a fully partitioned disk with data could be turned into a
> mirrored disk. A neat idea, but hardly the basis for a generic
> mirroring implementation when it silently corrupts a disk.
> I think it's better to change gmirror to use the first sector on the
> provider.

Yes, it would be cleaner to implement but it would also make the
mirrored devices unbootable.

But maybe the class of users needing the functionality is smaller now.

> This never creates a race condition and as such, you don't
> need to invent a priority scheme, that has it's own set of flaws on
> top of it. The only downside is that it's not easy to make a fully
> partitioned and populated disk part of a mirror: one would need to
> move the data forward one sector to free the first sector. This we
> can actually do by inserting a GEOM that does it while I/O is still
> ongoing. The good thing is: we need a class that does exactly this
> for implementing the "move" verb in gpart.

Looks too complicated and fragile. Maybe there's a need for
metadata-less automatic mirrors in some way, by storing the
configuration somewhere else, possibly in /etc.

More information about the freebsd-questions mailing list