boot0 and fdisk / disklabel misbehaviour

Dag-ErlingSmørgrav des at
Tue Nov 11 00:36:53 PST 2003

I've been busy installing various OSes on a spare disk in order to try
to reproduce some of fefe's benchmarks.  In the process, I've noticed
a couple of bogons in boot0 and disklabel:

 - disklabel -B trashes the partition table:

   # dd if=/dev/zero of=/dev/ad0 count=20
   # fdisk -i ad0
   (create a FreeBSD partition)
   # disklabel -rw ad0s1 auto
   # newfs -U /dev/ad0s1a
   # disklabel -B ad0s1a
   (this trashes the partition table)

   This probably happens because fdisk silently allows the user to
   create a partition that overlaps the partition table.  Arguably
   pilot error, but very confusing at the time, and fdisk should warn
   about it.

 - boot0 off-by-one error:

   The OS table in boot0.s is as follows:

                .byte os_misc-.                 # Unknown
                .byte os_dos-.                  # DOS
                .byte os_dos-.                  # DOS
                .byte os_dos-.                  # DOS
                .byte os_dos-.                  # Windows
                .byte os_dos-.                  # Windows
                .byte os_dos-.                  # Windows
                .byte os_linux-.                # Linux
                .byte os_bsd-.                  # BSD/OS
                .byte os_freebsd-.              # FreeBSD
                .byte os_bsd-.                  # OpenBSD
                .byte os_bsd-.                  # NetBSD

   Now, boot0 identifies my FreeBSD partitions as "BSD" instead of
   "FreeBSD".  It also identifies my Debian partition (type 0x83) as
   "BSD" instead of "Linux" and my Debian swap partition (type 0x82)
   as "DOS" instead of "Unknown", and NetBSD gives it the hives.  It
   seems to me that it's consistently off by one.

Dag-Erling Smørgrav - des at

More information about the freebsd-current mailing list