Subject: cgd "disklabel" verification cannot be used?
To: None <port-i386@netbsd.org>
From: Anne Bennett <anne@encs.concordia.ca>
List: port-i386
Date: 01/18/2007 07:35:04
I can't seem to get a CGD to work; this is NetBSD-3.1, i386.  I am trying
to follow the instructions in the NetBSD Guide and in the cgdconfig
manpage.  I have configured my kernel to support cgd, have created a
parameters file with:

  cgdconfig -v -g -o /etc/cgd/raid0e -V disklabel blowfish-cbc 128

and have initialized it with:

  cgdconfig -v -V re-enter cgd0 /dev/raid0e

so far, so good, but to use verification type "disklabel", I need
to have a valid disklabel on that device.  However, when I try to
follow the instructions to create such a disklabel:

  disklabel -e -I cgd0

(I start by just changing the label from "fictitious" to "cgd0", so I
can tell that it worked), I get this error:

  disklabel: Invalid signature in mbr record 0
  write: Read-only file system

and the kernel logs "cgd: error 30".

I thought it might be related to the fact that the proposed partition
list has only "a" and "d", both at offset 0, while this is an 1386
machine that might be looking for a BIOS partition table first.  And
indeed querying with fdisk results in :

  fdisk: primary partition table invalid, no magic in sector 0
  [...]
  Partition table:
  0: <UNUSED>
  1: <UNUSED>
  2: <UNUSED>
  3: <UNUSED>
  Bootselector disabled.

So I decided to try to initialize the disk with "fdisk -i", which has
no net effect (that is, I still cannot use "disklabel"), I tried then to
"fdisk -u", to obtain:

  Partition table:
  0: NetBSD (sysid 169)
      start 63, size 10485697 (5120 MB, Cyls 0-652/180/41)
  1: <UNUSED>
  2: <UNUSED>
  3: <UNUSED>
  Bootselector disabled.
  [note: I also tried *with* bootblocks]

After that, I was able to write a disklabel with "disklabel -e -I cgd0",
which gives a default partition list of c (offset 63), d (offset 0),
and e (offset 63, same as c).

However, if I unconfigure the device and try to configure it with the
password I entered before, but in the default "disklabel" verification
mode, it rejects my attempts with:

  /dev/raid0e's passphrase:
      with alg blowfish-cbc keylen 128 blocksize -1 ivmethod encblkno
   verification failed, please reenter passphrase
   /dev/raid0e's passphrase:

I really suspect that it doesn't see my (BIOS) disklabel as a valid
disklabel.  If I use the "re-enter" verification method again, it works
and I see my modified disklabel, so the device *can* be configured again
properly, just not with a safe verification method.

I tried verification method "ffs" as well, with no greater success; I
suspect that block 63 is just too late for cgdconfig.  This is just a
guess, but I suspect if it doesn't see something it likes starting at
block zero, it won't verify.

I have not tried this on a non-raid partition; no idea if that would make
any difference at all.

Has anyone managed to get cgd to verify with method "disklabel"
on an i386 system?


Anne.
-- 
Ms. Anne Bennett, Senior Sysadmin, ENCS, Concordia University, Montreal H3G 1M8
anne@encs.concordia.ca                                    +1 514 848-2424 x2285