Subject: Re: A FreeBSD problem (off topic ?)
To: Rakhesh Sasidharan <>
From: Steinar Hamre <>
List: netbsd-users
Date: 08/16/2000 22:36:11
(ok, _now_ we're getting off topic)

Rakhesh Sasidharan <> writes:

> On 16 Aug 2000, Steinar Hamre wrote:
> > In FreeBSD you access other "PC"-partitions via the "slice"-devices
> > (/dev/ad0s1 and so on).
> Actually, the problem is slightly more technical.  I know how FreeBSD
> handles disklabels, but what I (more precisely) want to know is how to
> construct one.  That is, when I installed NetBSD after installing FreeBSD,
> FreeBSD somehow automatically recognized the partitions in the NetBSD
> slice and made the entries etc for it.  I wan't a similar thing for my
> extended partitions.

You have 4 primary partitions. One (and only one) of these may have
partition id 5 "Extended DOS" and is partitioned futher in a "linked
list" manner into "logical" (sub)partitions.

FreeBSD normally handles logical partitions by assigning them
partition number 5 and upwards (just like Linux (and HURD (acctually
the HURD partitioning system is modeled very closely after FreeBSD))).
Use /dev/da0s5 and so on for logical partitions. If you lack a device,

Note that although FreeBSD fdisk cannot create logical partitions,
FreeBSD have no problem using them, and all primary and logical
partitions can be subpartitioned further with a disklabel (but you do
not put a disklabel on the extended partition itself), resulting in
partition names like /dev/da2s16f. I'm using this technique to create
62 partitions on a single disk. (with a maximum of 7 usable partitions
each disklabel, I need at least 9 "PC" partitions).

> I figured out that if I were to make an ASCII file filled with the
> partition info (calculated based on the start and end points and the known
> sizes of each partitions), then I can used 'disklabel -e -R filename wd0'
> to make FreeBSD acknowledge that partition.  But I think (and please
> correct me if I am wrong) that this in someway makes it write the info to
> the hard-disk itself.

Yes, this would install the disklabel on the start of the
_disk_itself_ (where it might crash with MBR or boot code following
the MBR) and not a partition.

>  Coz, I had OpenBSD long ago, and FreeBSD didn't automatically
> figure the OpenBSD slice, and then I had to use this

I *think* FreeBSD did not figure the OpenBSD disklabel because either
it is not looking for a disklabel (OpenBSD or not) in "PC"-partitions
with the new OpenBSD partition id and/or it don't know how to use the
OpenBSD disklabel itself.

If you create a partition with the NetBSD partition id and NetBSD
disklabel (which both happen to also be the _old_ OpenBSD partition id
and disklabel format), then I think you can install OpenBSD on top of
that and access those (sub)partitions from FreeBSD.

> technique to get things to work.  But then, that spoilt OpenBSD's view of
> things (as you said earlier, disklabels are treated different in FreeBSD
> and Net/OpenBSD), and I had to edit things once more there to make things
> work.

I do not understand what you where trying to get to work or exactly
what you did to resolve this, but generally installing a FreeBSD
disklabel on anything but a FreeBSD partition is a very bad idea. It
seems to me you where replasing the OpenBSD disklabel with the FreeBSD
one (Then fixing it from OpenBSD, which probably converted it to a
old-style OpenBSD disklabel or something). I probably don't want to
know exactly what you did. ;-)

> Is this the right way to do things ?  Or is there someother way in which I
> could have got FreeBSD to recognize my OpenBSD side ?  And how should I go
> abt getting it to recognize my Linux logical drives ?  If I just type
> 'disklabel -e wd0s3' (where wd0s3 is the Linux part), it gives me some

"Logical partitions" in FreeBSD use "PC"-partition number 5 and

> error.  Then I tried 'disklabel -e -r wd0s3' and it said the slice is
> unlabelled.  The only thing I can think of, is the '-R' option.  But I
> hope it won't distort Linux's view of things.  Any advice please ?

Don't put a disklabel on a non BSD partition (extended or linux or

> > Most NetBSD ports have a upper limit of 8 partitions. OpenBSD/i386
> > have 16 partitions. I think we should go for this or a even higher
> > number of partitions (32? 256?). Increasing the number of partitions
> > will probably result in a incompatible disklabel, but in my opinion,
> > disklabels will have to be redone sooner or later anyway, as most
> > information kept in the disklabel is way out of date.
> What do u mean by incompatible disklabels ?  Between the different BSD's,
> or something else ?

Today NetBSD, FreeBSD and OpenBSD all have different (incompatible)
disklabels. This does _not_ make it impossible to understand each
others disklabels, when needed. If NetBSD where to change it's
disklabel format (e.g. to support a higher number of partitions), you
would get problems using this (new) label from FreeBSD or an older
version of NetBSD.