Re: Disk Structures

From: Sad Clouds <cryintothebluesky_at_gmail.com>
Date: Sun, 14 Dec 2025 08:42:22 UTC
On Sat, 13 Dec 2025 13:54:04 -0800
Doug Hardie <bc979@lafn.org> wrote:

> mail# df -h
> Filesystem          Size    Used   Avail Capacity  Mounted on
> /dev/ufs/rootfs     108G    9.1G     90G     9%    /
> devfs               1.0K      0B    1.0K     0%    /dev
> /dev/msdosfs/EFI     50M     25M     25M    50%    /boot/efi
> tmpfs                12G     85M     12G     1%    /tmp
> /dev/da0s2           25G    1.3G     22G     6%    /mailbkup
> mail# 
> 
> The entries for / and /boot/efi are not at all what I expected.  The /mailbkup seems normal.  How do I make sense of all this?

What do you mean by "not what you expected"? If you refer to
the /dev/XXX paths, then it looks like / and /boot/efi are mounted using
file system labels and /mailbkup is mounted using MBR slice.

I have instructions on how to format Raspberry Pi disk with GPT and
install FreeBSD but never got round to publishing this on my blog.

I only have Raspberry Pi 4 and I normally mount
FreeBSD-15.0-RELEASE-arm64-aarch64-RPI.img and copy all files in
/boot/efi or /boot/msdos as this contains the bootloader.

After this I manually format microSD card or USB disk with FAT32 and GPT
partitions and install FreeBSD.

The following commands were executed on Raspberry Pi 4 with FreeBSD on
microSD card and installing it again to a USB disk. You may need to
double check /boot/loader.conf in case it is different for Pi 5.

geom disk list

... and find the disk you want to install to.

Create partitions:
gpart destroy -F da0
gpart create -s gpt da0
gpart add -t efi          -l "efi"         -a 1M -s 64M da0
gpart add -t freebsd-ufs  -l "root"        -a 1M -s 32G da0
gpart add -t freebsd-swap -l "swap"        -a 1M -s 4G  da0
gpart add -t freebsd-ufs  -l "var"         -a 1M -s 4G  da0
gpart add -t freebsd-ufs  -l "data"        -a 1M        da0
gpart show -l da0

Setup U-Boot:
newfs_msdos -F 32 -c 1 /dev/gpt/efi
mount -t msdosfs -o longnames /dev/gpt/efi /mnt
cp -a /boot/msdos/* /mnt
umount /mnt

Setup UFS:
newfs -j -L root        /dev/gpt/root
newfs -j -L var         /dev/gpt/var
newfs -j -L data        /dev/gpt/data

fetch \
  https://download.freebsd.org/ftp/releases/arm64/14.0-RELEASE/base.txz \
  https://download.freebsd.org/ftp/releases/arm64/14.0-RELEASE/lib32.txz \
  https://download.freebsd.org/ftp/releases/arm64/14.0-RELEASE/kernel.txz \
  https://download.freebsd.org/ftp/releases/arm64/14.0-RELEASE/kernel-dbg.txz

Setup root:
mount /dev/gpt/root /mnt && mkdir /mnt/var
mount /dev/gpt/var /mnt/var
for i in base lib32 kernel kernel-dbg; do tar -C /mnt -xpUf ${i}.txz; done
sync

mkdir /mnt/data

cat > /mnt/boot/loader.conf << 'EOF'
# Configure USB OTG; see usb_template(4).
hw.usb.template=3
umodem_load="YES"
# Multiple console (serial+efi gop) enabled.
boot_multicons="YES"
# Disable boot_serial as it causes console issues with single user mode
#boot_serial="YES"
# Disable the beastie menu and color
beastie_disable="YES"
loader_color="NO"
EOF

cat > /mnt/etc/fstab << 'EOF'
# Device       Mountpoint   FStype   Options               Dump  PassNo
/dev/gpt/root  /            ufs      rw                    1     1
/dev/gpt/efi   /boot/efi    msdosfs  rw,noatime            0     0
/dev/gpt/swap  none         swap     sw                    0     0
/dev/gpt/var   /var         ufs      rw                    2     2
/dev/gpt/data  /data        ufs      rw                    2     2
tmpfs          /tmp         tmpfs    rw,size=1g,mode=1777  0     0
EOF

cat > /mnt/etc/rc.conf << 'EOF'
hostname="netsrv.home.lan"
keymap="uk.kbd"
ifconfig_genet0="inet 192.168.1.18/24"
defaultrouter="192.168.1.254"
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
sshd_enable="YES"
powerd_enable="YES"
dumpdev="AUTO"
update_motd="NO"
EOF

cat > /mnt/etc/resolv.conf << 'EOF'
search home.lan
nameserver 192.168.1.4
EOF

umount /mnt/var /mnt