Subject: "mbrlabel" weirdness - bug or feature?
To: None <port-i386@netbsd.org>
From: Alec Muffett <alecm@crypticide.com>
List: port-i386
Date: 02/18/2005 11:42:56
Hi,

I am installing NetBSD onto a Toshiba Libretto 100ct with varying
degrees of success; the operating system is wonderful, well-integrated
(hey, I can drive my wireless card with "ifconfig"!) but seems to be
having a slight hissy-fit regarding hard disk partitions.

To cut a long story short:

  * I am installing the hard disk on another PC before swapping it
    back to the Libretto, for speed and convenience reasons.

  * Because the Libretto would try and hibernate by writing its
    memory to BIOS cylinders in the area around cylinder 1024, I
    have to leave a gap in that area; I achieve this by creating a
    Linux Swap partition (#1) that extends a short distance either
    side of BIOS cylinder 1024, from 1010 to 1040, as shown in this
    "fdisk" output:

     
http://www.crypticide.com/users/alecm/albums/tmp/netbsd-diag/web- 
fdisk.jpg

  * The NetBSD root partition is #0, a little less than 8Gb, as
    also shown in the above.

  * Partition #2, I leave blank, for reasons I will explain later.

  * Partition #3 is set as an Extended partition, for reasons I
    will explain later.

  * Partition E0 is the entire remainder of the disk, about 20Gb,
    and I have set it to be a NetBSD partion also.

NetBSD installs just fine, although it does not seem to do
anything about getting ahold of partition E0 or any other devices;
it seems that the NetBSD installer just wants to deal with the
NetBSD root partition, and the sub-partitions inside.

When I reboot and later try to get ahold of partition "E0" to
newfs and mount it, things go wrong.

After a fresh installation, the "disklabel" (VTOC to Solaris
people) will only show those partitions which were known by the
installer, as-per this output:

    
http://www.crypticide.com/users/alecm/albums/tmp/netbsd-diag/web- 
disklabel.jpg

In "disklabel" notation:

  * partition "a" is the root filesystem, and resides within
    disk-partition #0, as shown above

  * partition "b" is the NetBSD swap partition, and also resides
    within disk-partition #0, as shown above

  * partition "c" is an overlay partition, which maps to the
    entirety of disk-partition #0

  * partition "d" is an overlay partition, which maps to the whole
    disk - all 30Gb of it.

Hypothetically you then run the "mbrlabel" command, which updates
your disklabel to contain entries for the other disk-partitions;
however this is what you get:

     
http://www.crypticide.com/users/alecm/albums/tmp/netbsd-diag/web- 
mbrlabel.jpg

  * partition "e" is the Linux swap partition (ie: hibernation
    space), mapping to disk-partiton #1

  * partition "f" is the BIG NetBSD partition, mapping to
    disk-partiton E0

...but look at that last entry! The one for partition "f"!
It's tiny!

The diags at the top of the command tell you that the command
knows the partition is 20457MB in size, but the entry that
"mbrlabel" would write for it that would be written to the
disklabel would be way undersized.

Does anyone know what's going on, please? Is this a bug, or a
feature? Or am I just plain wrong?

	- alec


ps: "mbrlabel" would not see the big partition at all, unless it
     was/is in an extended partiton; hence why disk-partition #3 is
     empty (since I like making EXT partitions #4 for historical
     reasons) and hence why there is an extended partition at all.


--
Alec Muffett
alecm@crypticide.com
http://www.crypticide.com/dropsafe/