GPT partitions on whole disk gmirror - questions about the metadata issue
Matthias Petermann
matthias at petermann-it.de
Wed Nov 21 12:16:45 UTC 2018
Hello,
in the meantime I did some further research and found out that newfs has
a parameter to reserve some space at the end of the to be formatted
device. The manpage newfs(8) states:
"-r reserved
The size, in sectors, of reserved space at the end of the
partition specified in special. This space will not be occupied
by the file system; it can be used by other consumers such as
geom(4). Defaults to 0.
"
Anyway, I did not see anyone using the -r parameter using for formatting
a filesystem in a gmirror based device[1], and wondering at the same
time as the default of "0" would mean to me that at some point - maybe
only after the filesystem has filled up - it would touch the very last
block on the disc and overwrite the gmirror meta data. Especially in the
case of the illustrated workaround for GPT partitioned devices:
+---------------------------------------------------------------------+
|+-------------------------------------------------------------------+|
||+-----------------------------------------------------------------+||
|||+---------------------------------------------------+-----------+|||
|||| UFS Filesystem | gmirror ||||
|||| | meta ||||
|||| | data ||||
|||+---------------------------------------------------+-----------+|||
||| /dev/mirror/data |||
||+-----------------------------------------------------------------+||
|| /dev/gpt/data1 ||
|+-------------------------------------------------------------------+|
| /dev/ada0 |
+---------------------------------------------------------------------+
So what is the general advice to deal with that? Is it safe to use newfs
without -r and why?
Kind regards,
Matthias
[1] http://www.wonkity.com/~wblock/docs/html/gmirror.html
[2]
https://forums.freebsd.org/threads/freebsd-10-2-install-with-gpt-and-gmirror.55400/
[3]
https://www.ateamsystems.com/tech-blog/installing-freebsd-9-gmirror-gpt-partitions-raid-1/
Am 21.11.2018 um 05:47 schrieb Matthias Petermann:
> Hello,
>
> in section 18.3 of the FreeBSD handbook[1] there is a warning regarding
> using whole disc mirroring with gmirror together with GPT:
>
> "gmirror(8) stores one block of metadata at the end of the disk. Because
> GPT partition schemes also store metadata at the end of the disk,
> mirroring entire GPT disks with gmirror(8) is not recommended. MBR
> partitioning is used here because it only stores a partition table at
> the start of the disk and does not conflict with the mirror metadata."
>
> Why is it that gmirror does not represent the mirrored device for the
> levels above it in a way that does not allow access to the last block
> containing the metadata? Would it be enough to simply mimic a smaller
> device, one block less than the underlying providers?
>
> In the case mentioned above, the workaround is to first partition both
> providers using GPT and then form gmirrors from two GPT partitions each.
> In this case, the metadata problem should not be critical because
> gmirror exists within the partition itself. Here is my further question:
> how does the file system (UFS) ensure that e.g. newfs does not overwrite
> the last block of a gmirror in this setting?
>
> Best regards,
> Matthias
>
> [1] https://www.freebsd.org/doc/handbook/geom-mirror.html
>
--
Matthias Petermann <matthias at petermann-it.de> | www.petermann-it.de
GnuPG: 0x5C3E6D75 | 5930 86EF 7965 2BBA 6572 C3D7 7B1D A3C3 5C3E 6D75
More information about the freebsd-questions
mailing list