5.1-RELEASE: disklabel/bsdlabel for multi-boot system

Matthew Seaman m.seaman at infracaninophile.co.uk
Thu Sep 4 07:04:50 PDT 2003


On Wed, Sep 03, 2003 at 07:54:12PM -0500, Meow Cat wrote:
> Hi,
>   Before starting, I should say that I've RTFM'd, looked 
> in
> the FAQ and the mailing lists, etc. I've seen lots of 
> people
> complaining about similar problems but no answers.
>   I have an existing partition table, and I'd like 
> FreeBSD
> to fit into it with as little damage to the existing OSs 
> as
> possible. The setup I have (as reported by OpenBSD 
> disklabel)
> is:
> 
>   a:   262144   257040    4.2BSD     1024  8192    16
>   b:    16384   519184      swap                     
>   c:   498015   257040    unused        0     0      
>   d:   219487   535568    4.2BSD     1024  8192    16
>   e:  4000122  6747363    4.2BSD     1024  8192    16
>   i:   256977       63    ext2fs                     
>   l:  5992245   755055     MSDOS                     
>   m: 45351432 10747548     MSDOS                     
>   n: 32001417 56099043     MSDOS                     
>   o: 32001417 88100523     MSDOS                     
> 
> It took me ages to figure out how to achieve this under
> OpenBSD, and then after install I couldn't get X to work.
> So I'm trying FreeBSD - of course bsdlabel only supports
> slices a-h for some reason that is never explained, so I
> have to delete half of the slices. Fine, I do that.
> So with a heavily edited label file I try:
> bsdlabel -R /dev/ad2s0 bsdlabel_file

Unfortunately I don't think you can use an OpenBSD disk label on a
FreeBSD system, or vice-versa.  Seems that the OpenBSD folks have
revamped the way the label data is arranged on the disk, incidentally
giving themselves 16 possible partitions rather than the 8 available
under FreeBSD.
 
> Every slice starts "after end of unit" and "extends beyond
> end of unit." The c slice "doesn't cover entire unit!"
> 
> Okay, I can deal with that, I think - just extend the c
> slice to cover the entire disk, use "bsdlabel -A" (after a
> "bsdlabel -w") to read the disk configuration and edit it
> to ensure that it's not broken, and try again.



If you're trying to support multiple OSes on this one disk, then under
FreeBSD you'ld tend to give FreeBSD a slice of it's own, using
fdisk(8) -- there's a terminology problem here that confuses a lot of
people.  See
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/install-steps.html
particularly 'Example 2.4. Conceptual Model of a Disk' about what
FreeBSD means by 'partitions' and 'slices'.  Under /dev, you'll see a
heirarchy of devices for each drive:

    /dev/ad0    The whole primary master drive

    /dev/ad0s1  The first slice on that drive

Anyhow, within the FreeBSD slice you then create the FreeBSD
partitions using disklabel(8), or as it seems to have mutated into on
5.x-RELEASE, bsdlabel(8).  This gives you devices:

    /dev/ad0s1a The root partition
    /dev/ad0s1b The swap area
    /dev/ad0s1c The whole slice 
    /dev/ad0s1d Another partition...

so /dev/ad0s1c and /dev/ad0s1 effectively mean the same thing, which
is a bit redundant.  Unfortunately the concept that "the c partition
is the whole [disk|slice]" is so deeply embedded in the psyche (not to
mention the source code) of the BSD's it isn't going to be changed any
time soon.
 
> I get the same errors. How can the first slice possibly
> begin "after end of unit" and what do I do to fix this?
> How are these "unit"-related numbers calculated? Does
> "unit"===entire-hard-disk? Why does this fail even when
> I make the c slice cover the entire hard disk?

This seems to be a confusion between the (DOS compatible) "Partition
table" as established by fdisk(8) and the (BSD specific) disk label.
If bsdlabel(8) is talking about slices, then something is definitely
wrong with the universe.
 
> Also, I'd like to have the a slice to be a small one
> from the main partition table, and /usr mounted on a
> larger slice within the extended partition table. I
> managed this under OpenBSD with the table above - is
> there a problem (other than the one I mentioned) with
> using this type of table in FreeBSD?

'Extended partitions' are a windows sort of thing, not hugely popular
in FreeBSD.  sysinstall(8) doesn't cope with them very well, but if
you have a pre-existing disk with them on, you can access them from
within FreeBSD as:

    /dev/ad0s5

or above.  They tend, however to be used for foreign filesystems
rather than native UFS ones.
 
> Finally, before you tell me to try sysinstall - I tried
> it. I'm sure it has its uses, but the interactive fdisk
> part is unable to understand extended partitions, and
> the interactive disklabel does not allow you to specify
> your own begin/end for slices, either in sectors, or in
> cyl/trk/head. So it's useless for my purposes. The only
> possible use I can see for it is for people who want to
> devote their entire machine to FreeBSD. That's something
> I noticed in OpenBSD also - both OSs seem about 10 years
> behind when it comes to supporting mutli-boot systems :(

Ah, but this whole PC disk layout thing hasn't changed significantly
in the last 10 years, despite the massive increase in the size of
disks over that time.  I know that it isn't overwhelmingly difficult
to create a multiboot system using any combination of FreeBSD, Linux,
Windows and Solaris/Intel you care to mention.  I've never tried
OpenBSD, so I can't comment on that score.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030904/7b69bdc5/attachment.bin


More information about the freebsd-questions mailing list