Subject: Re: disklabel questions
To: None <port-i386@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: port-i386
Date: 10/29/2001 20:06:58
In article <4069.702T2720T8515072geohei-ml@geohei.lu>,
Georges Heinesch <geohei-ml@geohei.lu> wrote:
>Quoting Christos Zoulas (28-Oct-01 20:36:46):
>
>This is when no disklabel is saved so far (for me, wd0), right?

Yes.

>>>- When displaying the disklabel of wd1 (NetBSD is on wd1), it's only
>>>  showing a-e (which is normal since I only have / and /usr).
>>>  However I have 4 more NTFS partitions on the disk.
>
>> You can define more and they will appear. Unused partitions of 0
>> size are not shown. You can use mbrlabel to find the rest of the
>> partitions and automatically define them.
>
>When I do this wd1 (where NetBSD is on), I destroy the a-e bsd label
>assignments. NetBSD becomes unusabel.

That means either:
	mbrlabel is buggy [have not had a problem personally]
	your fdisk partitions are overlapping with your bsd partitions

>When doing it with wd0 (no NetBSD system is installed), I see the
>primary + the extended partitions, but not the logical partitions
>inside the extended partition. However mbrlabel(8) says that it looks
>inside the extended partitions to see the logical partitions. This
>doesn't seem to be true.

The current one does I think. I don't know about the one in 1.5.2.

>----- cut here -----
>dimension# disklabel wd0
>[...]
>track-to-track seek: 0  # microseconds
>drivedata: 0
>
>8 partitions:
>#        size   offset     fstype   [fsize bsize   cpg]
>  d: 33750864        0     unused        0     0         # (Cyl.    0 - 33482)
>[...]
>----- cut here -----
>
>> It will not trash your mbr. It will only write a partition table.
>
>#disklabel -e -I wd0
>
>The next boot showed:
>    MBR corrupt! Run BootMagic configuration
>    Press any key to boot active partition
>
>After running the BootMagic configuration (exiting with save,
>everything was fine again. But why did this message appear?
>
>After starting NetBSD any saying "disklabel -r wd0", the disklabel was
>gone again! Does this mean that BootMagic cannot be used together a
>disklabel on wd0?

Not at the same location. It appears that disklabel wants to write itself
at the beginning of the disk, because there is no c partition, and the
d partition starts at 0, so you are actually killing your mbr.

You want to make sure that fdisk and the bsd disklabel agree. And also
that you have a c partition that starts at the right spot [not at sector
0 but at sector 63 if NetBSD is at the beginning of the disk]

>>>- Is it correct that mbrlabel just reads the MBR and creates the
>>>  disklabel (in RAM only - not in-core)?
>
>> It can do both, depending on the flags you pass it.
>
>mbrlabel(8) doesn't show any options.
>
>This is all very complicated and tricky!

Sorry about that, all I can say is that this is the trickiest part.

The following is from /current.

christos

MBRLABEL(8)             NetBSD System Manager's Manual             MBRLABEL(8)

NAME
     mbrlabel - update disk label from MBR label(s)

SYNOPSIS
     mbrlabel [-fqrw] device