Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Oct 2017 10:22:02 -0600 (MDT)
From:      Warren Block <wblock@wonkity.com>
To:        Fabian Keil <freebsd-listen@fabiankeil.de>
Cc:        Jonathan Bond-Caron <jbondc@gdesolutions.com>, "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: GELI disk and glabel label
Message-ID:  <alpine.BSF.2.21.1710081012510.60060@wonkity.com>
In-Reply-To: <20171007133532.0c647a07@fabiankeil.de>
References:  <CY4PR17MB1111E0EB793D6970B7CEF7C4B7700@CY4PR17MB1111.namprd17.prod.outlook.com> <20171007133532.0c647a07@fabiankeil.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 7 Oct 2017, Fabian Keil wrote:

> Jonathan Bond-Caron <jbondc@gdesolutions.com> wrote:
>
>> I was trying to organize hard disk using labels and labelled two geli
>> disks: https://marc.info/?l=freebsd-questions&m=147526341300616&w=2
>
> Note that this post seems to be about gpt labels,
> not about glabel labels.
>
> They are not the same kind of label (and there are various other
> types of labels in FreeBSD). As you have just discovered, sometimes
> the difference matters.
>
>> glabel secure /dev/da1
>> galbel backups /dev/da2
>>
>> The problem is now I can't mount them :/
>> geli attach -k /root/geli.key
>> geli: Cannot read metadata from /dev/da1
>
> As Bernt already explained, that's the expected behaviour.
>
> While it's possible to relocate the geli metadata, before adding a
> "glabel label", the process is a bit tedious and I wouldn't recommend
> trying it unless you already know that your backups work.

It should not need to be relocated.  The problem is using the wrong 
device.  Both geli and glabel create a new device in /dev.  That device 
is one block smaller than the source device.  If you continue to refer 
to the root device, new metadata will overwrite the old.  Instead, use 
the newly-created device.  For example:

Create a glabel device on /dev/da1 called foo:
   glabel label foo /dev/da1

There is now a device called /dev/label/foo.  It is one block smaller 
than /dev/da1 to prevent writing to the metadata at the end.  Use this 
new device for further work, like creating a geli device (which will be 
called .eli).

If you mistakenly create another GEOM device on the raw /dev/da1, it 
will overwrite the metadata that is already at the end, as happened 
here.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.21.1710081012510.60060>