Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Sep 2004 06:52:34 -0400
From:      Allan Fields <bsd@afields.ca>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        freebsd-geom@freebsd.org
Subject:   Re: Can't reattach gbde slice [testing]
Message-ID:  <20040908105234.GJ34157@afields.ca>
In-Reply-To: <47899.1094471865@critter.freebsd.dk>
References:  <20040903214133.144779e2.dot@data.pl> <47899.1094471865@critter.freebsd.dk>

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

--OBd5C1Lgu00Gd/Tn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Sep 06, 2004 at 01:57:45PM +0200, Poul-Henning Kamp wrote:
> In message <20040903214133.144779e2.dot@data.pl>, DOT writes:
> >On Thu, 2 Sep 2004 16:05:56 -0400
> >Allan Fields <bsd@afields.ca> wrote:
> >
> >> Can you indicate your number_of_keys parameter you are
> >> using in -i?  Anyone using anything other than default 4?
> >
> >In both situations my device was initialized with number_of_keys set
> >to 1 (one).
>=20
> Another idea:  Do you use a detached lock-location file  (-L option
> to gbde init) ?

I've reproduced again (consistently) during tests and can file
a PR if you want:
	- number_of_keys=3D1
	- raw slice w/o a disklabel (either in primary or extended)
	- assume any 5.x so far

bench# uname -a
FreeBSD bench 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Sun Aug 15 06:26:20 EDT 2=
004
   root@bench:/usr/obj/usr/src/sys/GENERIC  i386

bench# gbde init /dev/ad0s16 -f/dev/stdin<<-_INIT_ -L /etc/ad0s16.lock
    number_of_keys=3D1
_INIT_
Enter new passphrase: test
Reenter new passphrase: test
Wrote key 0 at 2767794688
bench# sh -c "echo $[2767794688/512]
5405849
bench# dd if=3D/dev/ad0s16 skip=3D5405849 bs=3D512 count=3D1|md5
1+0 records in
1+0 records out
512 bytes transfered in 0.002607 secs (196404 bytes/sec)
d6b04b35b7c8dc492a8ec1c085a7d3e9
bench# md5 /etc/ad0s16.lock
MD5 (/etc/ad0s16.lock) =3D ec2b824243467446bfb13f95b0785b7d
bench# gbde attach /dev/ad0s16 -l /etc/ad0s16.lock
Enter passphrase: test
bench# ls -l /dev/ad0s16*
crw-r-----  1 root operator	4, 33 Sep  2 14:22 /dev/ad0s16
crw-r-----  1 root operator	4, 49 Sep  2 14:22 /dev/ad0s16.bde
bench# newfs -U /dev/ad0s16.bde
bench# mount /dev/ad0s16.bde /testbde
bench# cp -RPp /usr /testbde
bench# dd if=3D/dev/random of=3D/testbde/filler
bench# reboot
=2E..

bench# gbde attach /dev/ad0s16 -l /etc/ad0s16.lock
Enter passphrase: test
bench# ls -l /dev/ad0s16*
crw-r-----  1 root operator	4, 33 Sep  2 14:22 /dev/ad0s16

bench# gbde attach /dev/ad0s2d -l /etc/ad0s2d.lock
Enter passphrase: test
bench# ls -l /dev/ad0s2d*
crw-r-----  1 root operator	4, 18 Sep  2 14:22 /dev/ad0s2d
crw-r-----  1 root operator	4, 49 Sep  2 14:22 /dev/ad0s2d.bde
bench# dd if=3D/dev/ad0s16 skip=3D5405849 bs=3D512 count=3D1|md5
1+0 records in
1+0 records out
512 bytes transfered in 0.000564 secs (907643 bytes/sec)
78b5f14a13c85ae4eac30e5546606abd
bench# md5 /etc/ad0s16.lock
MD5 (/etc/ad0s16.lock) =3D ec2b824243467446bfb13f95b0785b7d

I'm pretty sure I got the passphrase correct.

Can you verify my math/methods of hashing the key sector?
(If I had zero'd or otherwise wipe out the specified sector w/ dd
as above I can stop the bde device from attaching.)


> If not, is there any chance the first sector of the gbde partition
> has been overwritten ?  Check your disklabels etc.  Also, if it starts
> at the very beginning of the disk, check that nothing slammed a MBR
> or similar down there.

Doesn't look like this is the problem, though sector zero does
change after writing to the device and rebooting.  I'll assume this
is OK when -L/-l are in use.

Haven't done any boundry/offset tests yet though next step for me
is to try debugging / determine if number_of_keys=3D4 has similar
issues w/ raw partitions.
=09
> --=20
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk@FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe   =20
> Never attribute to malice what can adequately be explained by incompetenc=
e.


Another thing: Given DAG, can we reasonably expect configs such as:
  ad0s2.bdef
  da4.bdes1a
etc. to work?  Valid combos (w/ slice->part constraint) I see:
  dev--bde-------->part-------fs
  dev--bde->slice-------------fs
  dev-------slice------->bde--fs
  dev-------slice->part-------fs
  dev------------->part->bde--fs
  | slice=3D>dos partition, part=3D>disklabel

So far my attempts at parsing device specs in C has proved interesting.

Thanks,
--=20
 Allan Fields, AFRSL - http://afields.ca
 2D4F 6806 D307 0889 6125  C31D F745 0D72 39B4 5541

--OBd5C1Lgu00Gd/Tn
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQFBPuRx90UNcjm0VUERAiN+AJoCgQq1oH8OVBrf5Tzti69H9M/3jwCfTpw9
g8G8w1a0CD1s0DlPYnEAaQw=
=kJ3t
-----END PGP SIGNATURE-----

--OBd5C1Lgu00Gd/Tn--



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