GELI disk and glabel label
Warren Block
wblock at wonkity.com
Sun Oct 8 16:22:08 UTC 2017
On Sat, 7 Oct 2017, Fabian Keil wrote:
> Jonathan Bond-Caron <jbondc at 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.
More information about the freebsd-questions
mailing list