Can't reattach gbde slice [testing]
Allan Fields
bsd at afields.ca
Wed Sep 8 03:52:37 PDT 2004
On Mon, Sep 06, 2004 at 01:57:45PM +0200, Poul-Henning Kamp wrote:
> In message <20040903214133.144779e2.dot at data.pl>, DOT writes:
> >On Thu, 2 Sep 2004 16:05:56 -0400
> >Allan Fields <bsd at 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).
>
> 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=1
- 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 2004
root at bench:/usr/obj/usr/src/sys/GENERIC i386
bench# gbde init /dev/ad0s16 -f/dev/stdin<<-_INIT_ -L /etc/ad0s16.lock
number_of_keys=1
_INIT_
Enter new passphrase: test
Reenter new passphrase: test
Wrote key 0 at 2767794688
bench# sh -c "echo $[2767794688/512]
5405849
bench# dd if=/dev/ad0s16 skip=5405849 bs=512 count=1|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) = 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=/dev/random of=/testbde/filler
bench# reboot
...
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=/dev/ad0s16 skip=5405849 bs=512 count=1|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) = 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=4 has similar
issues w/ raw partitions.
> --
> Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG | TCP/IP since RFC 956
> FreeBSD committer | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
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=>dos partition, part=>disklabel
So far my attempts at parsing device specs in C has proved interesting.
Thanks,
--
Allan Fields, AFRSL - http://afields.ca
2D4F 6806 D307 0889 6125 C31D F745 0D72 39B4 5541
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-geom/attachments/20040908/7890218d/attachment.bin
More information about the freebsd-geom
mailing list