# Installing on Raspberry 4 with ZFS-Root on an external M2 SATA



## minimike (Mar 17, 2021)

Hi there 

I am new with ARM and Raspberry 4. But I don't like to die uneducated  What I have got:

Raspberry Pi 4 Model B with 8 GB Memory
StromPi 3
an External M2 Sata drive because I don't trust USB Sticks...

What I would like to have got:

FreeBSD 13 running in the Raspberry Pi installed on an ZFS-Root on the external M2 Sata drive via USB3

what I currently don't know is:

How interacts the U-Boot Bootloader with the FreeBSD Loader?
Do I have inside the loader.conf to write something like

```
zfs_load="YES"
vfs.root.mountfrom="zfs:tank/ROOT"
```
What I have to do that the U-Boot Bootloader takes the Partition with the ZFS-Pool to boot FreeBSD with Loader?
About the 8 GB Memory, do I have to change somthing?

thanks in Advance
cheers Darko


----------



## JohnnySorocil (Apr 1, 2021)

AFAIK in u-boot you need to load /boot/loader.efi (copied to EFI/EXFAT partition) and that file will load kernel, read loader.conf and set appropriate variables needed to boot).
Or you can rename loader.efi to (on EFI partition) efi\boot\bootaa64.efi and it should be picked automatically by u-boot.
That is the way I use on my (non-raspberry) ARM64 SBC, YMMV.


----------



## Heini (May 30, 2021)

Hi,
minimike, in therory, you could use the same approach as described by JohnnySorocil, if you first install UEFI firmware for RPi4. I did this with Linux and it works fine.

HTH...

Dirk


----------



## JozanOfAstora (Jun 9, 2022)

Hi minimike, I plan to do exactly the same thing, could you confirm this is working before I commit to buy everything?


----------



## Alain De Vos (Jun 10, 2022)

Or you can use ufs with a loader & following loader.conf settings in it:

```
### Selects the default device to loader the kernel from
currdev="zfs:ZT/ROOT/default:"
### Specify the root partition to mount
vfs.root.mountfrom="zfs:ZT/ROOT/default"
```
The freebsd-loader will then look for the ZFS filesystem for loading a kernel.


----------



## schorsch_76 (Jun 11, 2022)

I run FreeBSD on a Pi4 with 8gb and zfs. But on SD. I used the ufs image to write it to the SD. Booted and resized the partition. On the desktop I erased the ufs and created manually the zfs and dropped base and kernel on it. The uboot starts uefi and the loader.efi loads the kernel from zfs. Just like your desktop   no need for vfs.root.mountfrom.


```
Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-quest
ions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/free
bsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions
.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

To change this login announcement, see motd(5).
If you do not want to get beeps in X11 (X Windows), you can turn them of
f with

        xset b off
georg@raspberry-fbsd:~ $ uname -a
FreeBSD raspberry-fbsd 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n25
0148-fc952ac2212 GENERIC arm64
georg@raspberry-fbsd:~ $ zfs list
NAME                           USED  AVAIL     REFER  MOUNTPOINT
zpi                           10.4G  46.7G       96K  /zpi
zpi/ROOT                      1.44G  46.7G       96K  none
zpi/ROOT/default              1.44G  46.7G     1.43G  /
zpi/poudriere                 4.22G  46.7G      104K  /zpi/poudriere
zpi/poudriere/data             620M  46.7G      144K  /usr/local/poudrie
re/data
zpi/poudriere/data/.m           96K  46.7G       96K  /usr/local/poudrie
re/data/.m
zpi/poudriere/data/cache      4.62M  46.7G     4.62M  /usr/local/poudrie
re/data/cache
zpi/poudriere/data/images       96K  46.7G       96K  /usr/local/poudrie
re/data/images
zpi/poudriere/data/logs        119M  46.7G      119M  /usr/local/poudrie
re/data/logs
zpi/poudriere/data/packages    496M  46.7G      496M  /usr/local/poudrie
re/data/packages
zpi/poudriere/data/wrkdirs      96K  46.7G       96K  /usr/local/poudrie
re/data/wrkdirs
zpi/poudriere/jails           1.18G  46.7G       96K  /zpi/poudriere/jai
ls
zpi/poudriere/jails/131arm64  1.18G  46.7G     1.18G  /usr/local/poudrie
re/jails/131arm64
zpi/poudriere/ports           2.43G  46.7G       96K  /zpi/poudriere/por
ts
zpi/poudriere/ports/2022Q1     819M  46.7G      819M  /usr/local/poudrie
re/ports/2022Q1
zpi/poudriere/ports/2022Q2     831M  46.7G      831M  /usr/local/poudrie
re/ports/2022Q2
zpi/poudriere/ports/main       841M  46.7G      841M  /usr/local/poudrie
re/ports/main
zpi/swap                      4.13G  50.8G     11.8M  -
zpi/tmp                        200K  46.7G      136K  /tmp
zpi/usr                        655M  46.7G       96K  /usr
zpi/usr/home                   232K  46.7G      168K  /usr/home
zpi/usr/obj                     96K  46.7G       96K  /usr/obj
zpi/usr/ports                  654M  46.7G      104K  /usr/ports
zpi/usr/ports/distfiles        654M  46.7G      654M  /usr/ports/distfil
es
zpi/usr/ports/packages          96K  46.7G       96K  /usr/ports/package
s
zpi/usr/src                     96K  46.7G       96K  /usr/src
zpi/var                       2.39M  46.7G       96K  /var
zpi/var/audit                   96K  46.7G       96K  /var/audit
zpi/var/crash                  100K  46.7G      100K  /var/crash
zpi/var/log                   1.53M  46.7G     1.39M  /var/log
zpi/var/mail                   440K  46.7G      376K  /var/mail
zpi/var/tmp                    152K  46.7G       96K  /var/tmp
georg@raspberry-fbsd:~ $
```


----------

