glabel causes "GEOM: ada1: media size does not match label" messages

Maxim Khitrov max at mxcrypt.com
Sun Mar 20 22:35:15 UTC 2011


On Sun, Mar 20, 2011 at 4:38 PM, Maxim Khitrov <max at mxcrypt.com> wrote:
> Hi all,
>
> Executing the following commands on any valid storage device seems to
> cause "media size does not match label" kernel messages (FreeBSD 8.2
> amd64). I understand why they happen - glabel metadata occupies the
> last sector, so bsdlabel sees a device that is 1 sector smaller than
> what the kernel sees. The question is whether there is some simple way
> of suppressing these messages, since they come up every time the
> system is booted or the partition is mounted/unmounted:
>
> # glabel label vol0 ada1
> # bsdlabel -w /dev/label/vol0
> GEOM: ada1: media size does not match label.
> # newfs /dev/label/vol0a
> # mount /dev/label/vol0a /mnt
> GEOM: ada1: media size does not match label.
> # umount /mnt
> GEOM: ada1: media size does not match label.
>
> As you can see, I'm not using MBR or GPT partitioning schemes. I try
> to avoid those unless I plan on sharing the media with another OS.
> Even if using gpart would get rid of these errors (not sure, since
> then you'll just have a partition whose size doesn't match), I would
> still prefer to find some other way to suppress them.
>
> - Max
>

Heh... In the process of searching for a solution to this, I decided
to see what would happen if I used bsdlabel on ada1 rather than vol0
(in my example above), and created a 1-sector partition at the very
end of the disk. So the layout would be something like this:

# /dev/ada1:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a:        *        *    4.2BSD
  c:        *        0    unused
  h:        1        *    unused

The 'c' partition now covers the entire disk, which stops the kernel
from complaining about media size not matching the label. At the same
time, the 'h' partition will protect the last sector, which contains
glabel metadata.

The problem now is that the label is technically invalid for the vol0
device, which is what I'll be mounting. Indeed, bsdlabel complains
when I run it for /dev/label/vol0:

# /dev/label/vol0:
8 partitions:
#        size   offset    fstype   [fsize bsize bps/cpg]
  a: 3907029151       16    4.2BSD        0     0     0
  c: 3907029168        0    unused        0     0
  h:        1 3907029167    unused        0     0
partition c: partition extends past end of unit
bsdlabel: partition c doesn't cover the whole unit!
bsdlabel: An incorrect partition c may cause problems for standard
system utilities
partition h: partition extends past end of unit

I don't care about partition 'h'; it is there only to stop the
preceding partition from covering the last sector. Are there any real
issues with the 'c' partition being 1 sector too big for the vol0
device (but just the right size for ada1)?

This is a bit of a hack, but I'll take it if it stops the kernel from
complaining and doesn't create any new problems.

- Max


More information about the freebsd-questions mailing list