Subject: Re: disklabel questions
To: None <port-i386@netbsd.org>
From: Georges Heinesch <geohei-ml@geohei.lu>
List: port-i386
Date: 10/29/2001 14:11:54
Quoting Christos Zoulas (28-Oct-01 20:36:46):

> [...]

>>- Why is disklabel, of the disk where NetBSD is on, showing an NTFS
>>  partition with fstype "unused"? NTFS is a recognized filesystem.

> Well, there can be two "labels" on the disk. One is the mbr label,
> where there are four primary partitions and inside primary
> partitions there can be logical ones. This is manipulated by fdisk.
> The other is the bsd label and it is manipulated by disklabel. The
> bsd label lives inside one of the mbr labels,

Ok.

> or it exists without
> an mbr label.

This is when no disklabel is saved so far (for me, wd0), right?

>>- 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.

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.

Anyway, after a reboot, all is gone again (see below).

>>  - I know how to change the disklabel with (disklabel -e wd1), but
>>    how can I store this changes that the survive the next reboot?

> They will when you save and quit. You can use disklabel -r to access
> the raw partition, bypassing the in-core copy.

Does this mean that with the -r option, I change the in-core bsd
labels as well as the mbr bsd labels (I presume, yes)?

>>  - disklabel says that the max. number of labels is 8. However I
>>    read in a posting here some tome ago that the new number is 16.
>>    What's correct now?

> 16 is correct.

Thanks.

- I guess that the disklabels can be any 1 byte ASCII character?
- I also presume (not said in any man page or FAQ) that I can use any
  letter (also x or z)?

Why does disklabel say something of 8 partitions?

----- 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 -----

>>- After I edit the in-core disklabel of a disk which has no disk
>>  label, I get the following message:
>>
>>  disklabel: ioctl DIOCWDINFO: No disk label on disk;
>>  use "disklabel -I" to install initial label

> Yes, because disklabel has not been ran, so the disk does not have
> a bsd label yet. In this case the kernel generates a ficticious
> label that lives in core only.

... and doesn't consider primary or extended NFTS partitions. That's
at least what I found out. Those partitions are shown as "unused".

>>  What happens exactly when I say "disklabel -I"?
>>  I don't want to trash my MBR.

> 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?

>>- 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!

-- 
Cu  Georges Heinesch, Luxembourg
    geohei@geohei.lu
    http://www.geohei.lu
    PGP RSA & DH/DSS public key on request and on public servers

... N1, TO/GA, 80 KTS, V1, ROTATE, Postive climb, Gear up ...