Dfly Multiboot Installation Notes: Feedback

Martin Ivanov martin.ivanov at greenpocket.de
Tue Apr 21 03:40:09 PDT 2020


Hello,

I promised to prepare a page on multiboot installation of DragonFly. My 
notes are at the end of this message. Approximately 95% of the suggested 
procedure have been tested. I would be happy to get your feedback and 
critics. I would like to know whether you think the notes are worthy of 
getting space in the documentation and if yes, where, in which part of 
the documentation.

Thank you very much in advance!


DragonFlyBSD Multiboot Installation Notes

Note that there are non-existent as well as empty directories on the 
installation medium. These are:
Non-existent:
/usr/distfiles
/usr/dports
/usr/src
Empty:
  /usr/obj
  /var/cache
  /tmp

Installation steps:
Do:

nvmectl info
camcontrol devlist

to see which devices you have. We assume we have nvme0. Then:

dd if=/dev/zero of=/dev/nvme0 count=1024 bs=1m

Partition the hard drive:

gpt destroy nvme0
gpt create -f nvme0
gpt -v show nvme0

Add a slice with index 0.
-s specifies the slice size in sectors. A sector has 512 bytes. For an 
EFI Partition of half a GiB oder 512 MiB: (512 * 1024 ** 2) / 512= 1048576
-t specifies slice type: efi, swap, ufs, hfs, linux, dfly, hammer2.

gpt add -i 0 -s 1048576 -t efi nvme0

Add labels: labels must be UTF-8

gpt label -i 0 -l "EFI System" nvme0

gpt -v show nvme0

Add a 200GiB DragonFly partition

gpt add -i 1 -s 419430400 -t dfly nvme0

gpt -v show nvme0
gpt label -i 1 -l "DragonFly BSD" nvme0
disklabel64 -r -w nvme0s1 auto
disklabel64 -e nvme0s1
# a: 1G * 4.2BSD
# b: 16G * swap
# d: * * HAMMER2
gpt add -i 2 -s  419430400 -t "Unused" nvme0

Add a 200 GiB OpenBSD slice

gpt label -i 2 -l "OpenBSD" nvme0
gpt -v show nvme0
gpt add -i 3 -t linux nvme0

Use the remaining free space for Slackware

gpt label -i 3 -l "Slackware Linux" nvme0
gpt -v show nvme0

Make filesystems and mount them:

newfs_msdos nvme0s0
newfs nvme0s1a
newfs_hammer2 -L ROOT /dev/nvme0s1d
mount_hammer2 nvme0s1d /mnt
mkdir /mnt/boot
mount nvme0s1a /mnt/boot

Special care for the EFI System partition (ESP):

mkdir /efimnt
mount_msdos /dev/nvme0s0 /efimnt

Take care of the ESP:

mkdir -p /efimnt/EFI/BOOT

Install rEFInd:

cd /efimnt/EFI/BOOT
mount_? /dev/da?s? /usb
cp -r /usb/*/refind-bin-0.12.0/refind/* .

Remove the unnecessary drivers, efi executables and tools. E.g, for an 
amd64 machine you have to remove the *aa64* and *ia32* files and 
directories.

mv refind_x64.efi bootx64.efi
cp /boot/boot1.efi bootx64-dragonflybsd.efi
mv refind.conf-sample refind.conf
vi refind.conf
menuentry "DragonFly BSD" {
   loader /EFI/BOOT/bootx64-dragonflybsd.efi
   icon /EFI/BOOT/icons/os_dragonflybsd.png
}
menuentry OpenBSD: analogical
menuentry Slackware: analogical

cd

Create the H2 PFSs:

hammer2 -s /mnt pfs-create usr
hammer2 -s /mnt pfs-create usr.dports
hammer2 -s /mnt pfs-create usr.local
hammer2 -s /mnt pfs-create usr.src
hammer2 -s /mnt pfs-create var
hammer2 -s /mnt pfs-create home
hammer2 -s /mnt pfs-create build

Create the mount points for the PFSs:

mkdir /mnt/usr
mkdir /mnt/usr/dports
mkdir /mnt/usr/local
mkdir /mnt/usr/src
mkdir /mnt/var
mkdir /mnt/home
mkdir /mnt/build

Null-mount the non-empty PFSs:

mount_null nvme0s1d at usr /mnt/usr
mount_null nvme0s1d at usr.local /mnt/usr/local
mount_null nvme0s1d at var /mnt/var
mount_null nvme0s1d at build /mnt/build

Create the file systems under /build: these are the file systems that do 
not need backup; /build is something like scratch space in DragonFly:

mkdir /mnt/build/usr.distfiles
mkdir /mnt/build/usr.obj
mkdir /mnt/build/var.cache
mkdir /mnt/build/var.crash
mkdir /mnt/build/var.log
mkdir /mnt/build/var.spool

Create the mount points for the non-existent /build null mounts:

mkdir /mnt/usr/distfiles
Mount the /build null mounts:
mount_null /mnt/build/usr.distfiles /mnt/usr/distfiles
mount_null /mnt/build/usr.obj /mnt/usr/obj
mount_null /mnt/build/var.cache /mnt/var/cache
mount_null /mnt/build/var.crash /mnt/var/crash
mount_null /mnt/build/var.log /mnt/var/log
mount_null /mnt/build/var.spool /mnt/var/spool

Mount the TMPFSs:

mount_tmpfs tmpfs /mnt/tmp
mount_tmpfs tmpfs /mnt/var/tmp
mount_tmpfs tmpfs /mnt/var/run

Install DragonFly by copying the non-empty file systems. Luckily, cpdup 
won't cross mount boundaries on the source or destination, so it takes a 
few commands:

cpdup / /mnt
cpdup /boot /mnt/boot
cpdup /usr /mnt/usr
cpdup /usr/local /mnt/usr/local
cpdup  /var /mnt/var

Copy the non-empty /build null mounts:

cpdup /var/crash /mnt/var/crash
cpdup /var/log /mnt/var/log
cpdup /var/spool /mnt/var/spool

Copy the non-empty TMPFSs:

cpdup /var/tmp /mnt/var/tmp
cpdup /var/run /mnt/var/run

Use the correct /etc:

mv /mnt/etc /mnt/etc.live
mv /mnt/etc.hdd /mnt/etc

There is no fstab in /etc.hdd. The one from  /etc.live has to be copied

cp /mnt/etc.live/fstab.example /mnt/etc/fstab

Describe ALL mounts in fstab:

vi /mnt/etc/fstab
#edit
/dev/nvme0s1a /boot ufs rw 1 1
/dev/nvme0s1b none swap sw 0 0
/dev/nvme0s1d / hammer2 rw 1 1
/dev/nvme0s1d at usr /usr null rw 0 0
/dev/nvme0s1d at usr.dports /usr/dports null rw 0 0
/dev/nvme0s1d at usr.local /usr/local null rw 0 0
/dev/nvme0s1d at usr.src /usr/src null rw 0 0
/dev/nvme0s1d at var /var null rw 0 0
/dev/nvme0s1d at home /home null rw 0 0
/dev/nvme0s1d at build /build null rw 0 0
/build/usr.distfiles /usr/distfiles null rw 0 0
/build/usr.obj /usr null rw 0 0
/build/var.cache /var/cache null rw 0 0
/build/var.crash /var/crash null rw 0 0
/build/var.log /var/log null rw 0 0
/build/var.spool /var/spool null rw 0 0
tmpfs /tmp tmpfs rw 0 0
tmpfs /var/tmp tmpfs rw 0 0
tmpfs /var/run tmpfs rw 0 0
proc /proc procfs rw 0 0

#nosuid option for /home ?

vi /mnt/boot/loader.conf
#add
vfs.root.mountfrom:"hammer2:nvme0s1d"
umount /efimnt
umount /mnt/boot
umount /mnt/
halt
# remove the installation media
# press any key to reboot



-- 
Dr. Martin A. Ivanov
GreenPocket GmbH - Kundennähe durch Smart Metering -
Labor 3.09 | Schanzenstraße 6-20 | 51063 Köln
Telefon           +49 | 221 | 355095-0
Fax                   +49 | 221 | 355095-99
E-Mail              martin.ivanov at greenpocket.de

Webadresse  www.greenpocket.de



More information about the Users mailing list