Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jun 2006 16:55:42 +0200
From:      "no@spam@mgedv.net" <nospam@mgedv.net>
To:        <freebsd-questions@freebsd.org>
Subject:   /dev nodes population errors with GELI/bsdlabel
Message-ID:  <000001c68d67$1ce42720$01010101@avalon.lan>

next in thread | raw e-mail | index | archive | help

well. i'm quit sure, it's a little bit complicated to explain
what i did and what i figured out while i was doing it ;-), but:

short description:
attach->mount->umount->detach->attach->mount of GELI-encrypted
filesystems does not work correctly if the fs is on a bsdlabel-
partition inside the geli-provided device (/dev/???.eli).
after detach, the bsdlabel-created devicefiles /dev/???.elia
are left and after re-attach, they get duplicated (SAME NAME)
inside /dev.

the long version:

the hardware is as follows:
intel P4, 2.4, 768MB RAM
ad0 (my root disk): a SEAGATE 40GB UDMA-100 disk
ad4 (my test disk): a HITACHI 400GB UDMA-133 disk

i installed 6.1-RELEASE on ad0 as follows:
ad0s1a: /
ad0s1b: <swap> (not used currently)

the test-disk i originally configured using:

dd if=/dev/random of=/dev/ad4 bs=1m;
dd if=/dev/random of=/ad4.key bs=1024 count=256;
geli init -v -P -a AES -l 256 -K /ad4.key -s 4096 /dev/ad4;
geli attach -p -k /ad4.key /dev/ad4;
bsdlabel -w /dev/ad4.eli;
newfs -m 0 -o space /dev/ad4.elia;
mount -o rw,noatime /dev/ad4.elia /test

now, without storing any data on /test, everything seemed
to be ok. df showed the ~373GB being available on /test, nice.
playing around with the volume i also mounted/unmounted it.

umount /test;
geli detach /dev/ad4;

works fine. /dev/ad4.eli and /dev/ad4.elia were removed.

attaching the disk again with (with auto-detach enabled!):
geli attach -d -p -k /ad4.key /dev/ad4

and mounting it with:
mount -o rw,noatime /dev/ad4.elia /test

and finally again unmounting it with:
umount /test;

should automatically detach the device.
and indeed, this action is being logged to console/dmesg
from GELI as soon as i unmount it.

now, checking the files in /dev i STILL find a /dev/ad4.elia,
but /dev/ad4.eli is gone.

if i try to re-attach the GELI-disk, i get the file
/dev/ad4.eli back and i get 2 instances of /dev/ad4.elia,
which renders the device unusable.

this behaviour cannot be corrected until a reboot.

changing the /test disk from bsdlabel-layout to:
dd if=/dev/random of=/dev/ad4 bs=1m;
dd if=/dev/random of=/ad4.key bs=1024 count=256;
geli init -v -P -a AES -l 256 -K /ad4.key -s 4096 /dev/ad4;
geli attach -p -k /ad4.key /dev/ad4;
newfs -m 0 -o space /dev/ad4.eli;
mount -o rw,noatime /dev/ad4.eli /test

works fine and attach->mount->umount->detach (manual and auto)
behaves well and can be performed many times...

if there's some further interest on that by someone, i probably
can add some outputs/geli-debugs later. (box not networked now)


ps: don't cc me, i'm on the list...




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000001c68d67$1ce42720$01010101>