AW: AW: DragonFly BSD manual install: cannot boot

Dr. Martin Ivanov martin.ivanov at greenpocket.de
Sun Nov 11 04:17:43 PST 2018


Hello, 

I finally managed to install DragonFly BSD in a dual-boot setting with OpenBSD
on my machine. Thank you all for your valuable comments. Long story short, I had
to select the sysid for the DragonFly slice 165 and for the OpenBSD slice 166. 
Also, I had to create a separate disklabel partition for the /boot directory as 
the fist partition on the slice and format it with msdos. Finally, I installed the 
boot0 bootloader in the MBR of the hard drive in order to be able to select from a menu
which partition to boot.

Here follows in more detail what I did (Any commentaries on my questions and notes are welcome):

Manual BIOS installation of DragonFly BSD with OpenBSD in a classical MBR setting:
dd if=/dev/zero of=/dev/da0 bs=1m # zero out the disk to start clean
dd if=/dev/zero of=/dev/da0 bs=512 count=32 # zero out the disk to start clean
fdisk -Bi /dev/da0 # initialize sector 0 of the disk and install the MBR bootstrap code

fdisk da0
# The hard drive has a total number of sectors: 625142448
# create 2 slices: da0s0: 150 GiB for DragonFly and da0s1: 150 GiB for OpenBSD
# sysid for the dragonfly slice: 165 (supply explicitly, do not accept the default!)
# sysid for the openBSD slice: 166
# size: 314572800 (final size after corrections: 314560449)
# slice 2 starts at sector: 314560449 + 63 + 1 = 314560513 and has size
# 625142448 - 314560513 = 310581935. After corrections: start at 314560575,
# size 310576833.
I was not able to figure out how to tell fdisk to simply select the rest of the drive for
slice 2. Any ideas?
# Caution: 4 partitions are shown even if they do not exist. The 4th partition
# encompasses the whole disk and has to be deleted. For this purpose, it has to
# get a sysid of 0, start at 0, and have a size of 0.
# Note: after writing the partition table two mesages appear:
# da0s1: cannot find label (no disk label)
# da0s2: cannot find label (no disk label)
# make da0s1 bootable
dd if=/dev/zero of=/dev/da0s1 bs=512 count=32
disklabel64 -r -w -B /dev/da0s1 auto                             # Write a new standard volume label and install the bootstrap code for partition da0s1.
disklabel64 -e /dev/da0s1                                             # Add the disklabel partitions to /dev/da0s1	

				# add
				a: 1G 0 4.2BSD # the boot partition
				# add
				#    size     offset    fstype	fsuuid 
				  b: 8G * swap
                                  to add `b' partition with fstype `swap' and size 8GB
				# add
				  d: 50G * HAMMER
				  to add a 50GB root `d' partition with fstype `HAMMER'
				# add
				  e: * * HAMMER
				  to add home partition spanning the rest of the slice
# Note: I tried with the HAMMER2 filesystem, but the partitions failed to mount on the next steps.
# That is why I remained with HAMMER

newfs /dev/da0s1a                        # format the boot partition with UFS
newfs_hammer -L ROOT /dev/da0s1d         # format the root partition with HAMMER
newfs_hammer -L HOME /dev/da0s1e         # format the home partition with HAMMER

mount_hammer /dev/da0s1d /mnt            # mount the root partition: this fails with HAMMER2

mkdir /mnt/boot
mount /dev/da0s1a /mnt/boot

mkdir /mnt/home
mount_hammer /dev/da0s1e /mnt/home       # this also fails with HAMMER2

# copy the file systems:
cpdup /boot /mnt/boot			  # copy the boot partititon
cpdup / /mnt 	 			  # copy the root file system

# some system configuration:
vi /mnt/etc/fstab 	   	  # add 
		    	  /dev/da0s1a /boot ufs rw 1 1
	           	  /dev/da0s1b none swap sw 0 0
		     	  /dev/da0s1d / hammer rw 1 1
		     	  /dev/da0s1e /home hammer rw 1 1

vi /mnt/boot/loader.conf	  # add 
			    vfs.root.mountfrom="hammer:da0s1d"

#Finally, unmount the partitions and reboot the machine. Once the machine is in reset, before it hits the BIOS, unplug your installation media:
umount /mnt/boot
umount /mnt/home
umount /mnt

boot0cfg -B /dev/da0 # makes boot0 recognize the other available slices
reboot





________________________________________
Von: Tobias Heilig [0x70b1 at web.de]
Gesendet: Freitag, 2. November 2018 01:39
An: Dr. Martin Ivanov
Cc: users at dragonflybsd.org
Betreff: Re: AW: DragonFly BSD manual install: cannot boot

Hi Martin,

first, let's have a look at this quote from the prologue section of fdisk(8) man page:



In order for the BIOS to boot the kernel, certain conventions must be adhered to.
Sector 0 of the disk must contain boot code, a slice table, and a magic number.
BIOS slices can be used to break the disk up into several pieces. The BIOS brings
in sector 0 and verifies the magic number. The sector 0 boot code then searches the
slice table to determine which slice is marked ``active''. This boot code then brings
in the bootstrap from the active slice and, if marked bootable, runs it.

so, your first step

fdisk -iB /dev/da0   # initialize sector 0 of the disk and install the MBR

is correct; namely initializing sector 0 with the mbr bootcode from /boot/mbr.


your second step


# [...] I marked da0s1 as active.

is also correct.


now, the partition table is where you did a mistake, i guess. to my understanding
the first partition of the active slice should contain the bootstrap (/boot)
mentioned by the fdisk(8) quote to start your system. it is also done like that
in the example from the handbook [1]. this is missing in your partition layout.

so, maybe change this


disklabel64 -e da0s1

        a: 50G * HAMMER         # the root partition
        b: 8G  * swap
        d:  *  * HAMMER         # the /home partition


to this instead



disklabel64 -e da0s1

        a:  1G  *  4.2BSD       # the /boot partition (format as UFS)
        b:  8G  *  swap
        d: 50G  *  HAMMER       # the / partition
        e:   *  *  HAMMER       # the /home partition



you can find further instructions on formatting the partitions afterwards as well
as copying the system data and editing the /boot/loader.conf and /etc/fstab files
under [1].

i hope i did understand everything correctly and this is of any help to you.

[1] https://www.dragonflybsd.org/docs/handbook/Installation/#index3h1

--
best regards,

Tobi




More information about the Users mailing list