# Copy FreeBSD for Pi from a mini sd card to a full one.



## Logicien (Dec 20, 2021)

Hello,

I did a lot of work with my Raspberry-Pi-Model-B-Rev-2. Of course Raspbian have been in it, ArchLinuxArm, Gentoo too and FreeBSD. I have been please that this pi was doing well compiling Gentoo sources. It was stable with no crash but long. Now I have a problem. Raspbian started to display garbage when I was excuting a command remotely. I fsck all the partitions and it continue. Reinstalling the Raspbian image on the card fail too. ArchLinux have the problem that the pi do not boot like before like if it is rejecting the /boot/config.txt. I have try with the FreeBSD one but it do not boot.

I have try so many things. I used a mini sd card with FreeBSD using an adapter. It boot correctly everytime. Now I would like to use a larger and full sd card for more space and better performances. On ArchLinux for PC I did

dd if=/dev/sdf of=/dev/sde ibs=4M obs=4M status=progress

to make a bit to bit copy of all the sectors from the mini sd card to the full one (no adaptor). The full card do not boot on the Pi. What can (must) I do? What is blocking FreeBSD for the pi to boot from a bit to bit copy?


----------



## covacat (Dec 20, 2021)

how do you plug a full size sd card into a pi ?
using an usb reader ?


----------



## Logicien (Dec 20, 2021)

No plugging it in the sd card slot of the pi.


----------



## covacat (Dec 20, 2021)

try to md5sum first few megs for the 2 cards and compare


----------



## eternal_noob (Dec 20, 2021)

The FreeBSD image for the Raspberry Pi has a problem with the u-boot boot loader (PR 255080) on on some Raspberry Pis.
I don't know if this is a problem for your Raspberry-Pi-Model-B-Rev-2 as well, but you might want to try updating it.

You need a working FreeBSD installation to install u-boot-rpi-arm64 and then copy the file /usr/local/share/u-boot/u-boot-rpi-arm64/u-boot.bin over into the boot partition or the Pi.

*Edit: the above instructions is for a PI 4/400, you have to use the appropriate package instead.*

See https://forums.freebsd.org/threads/freebsd-wont-boot-on-rpi-4-4b-8gb-ram.81778 and https://forums.freebsd.org/threads/...freebsd-13-install-on-raspberry-pi-400.79941/


----------



## Logicien (Dec 20, 2021)

Two good suggestions. I will try. I come to switch from quaterly to latest on the mini sd card. I will make a new copy of it on the full sd card and try again. I will check the md5 too.


----------



## covacat (Dec 20, 2021)

i have rpi-b image on a pi zero
it works as is
booting is painfully slow but i found that using the msdosfs files from the 11.2? image it boots a lot faster
seems like it has a stage less
with the 13.0 shipped boot files the initial boot stages look like 




_View: https://www.youtube.com/watch?v=PjwnIm5Y6XE_


----------



## Logicien (Dec 21, 2021)

Hello again,

I don't know what have happen with this pi. It was booting well before with a full sd card. Now it seem's to want to boot only with a mini sd card with an adaptor and not any adaptor, a TD one. So my bit to bit copy have work from a mini sd card of 8G to a one of 16G. My new problem is that the 16G mini sd card only use 8G as the root filesystem. I was thinking that the fact that the line

growfs_enable="YES"

in /etc/rc.conf would enlarge the root file system automatically but no even by adding the file

touch /firstboot

So how can I enlarge the root filesystem from 8G on a mini sd card of 16G. FreeBSD work well on this clone.


----------



## eternal_noob (Dec 21, 2021)

What image are you using, btw.?


> One of the problem with the RaspberryPi is that there are a lot of different version nowadays and they all share similar names. For instance if you say _RPi B+_, is it _RPi3 B+_ from 2018, _RPi1 B+_ from 2014, a confusion with the _RPi2 B v1.2_ from 2016 or the _RPi2 B_? All these run on different SoC with different flavor of ARM from ARMv6 to ARMv8. *You must pay attention to choose the correct image for your board.*





			FreeBSD on RaspberryPi | Gawen's blog


----------



## Logicien (Dec 21, 2021)

After reading on this page https://elinux.org/RPi_SD_cards , I have learn that my pi model need a micro sd card to work. So I understand why I had problems with the largest ones. I am stuck resizing the a5 slice to fit the size of the card and enlarge the a and c BSD partitions and eventually add a swap partition who is not present in the BSD for pi image. I have difficulties to understand Gpart and Fdisk for Linux do not help me much.


----------



## T-Daemon (Dec 21, 2021)

Logicien said:


> I am stuck resizing the a5 slice to fit the size of the card and enlarge the a and c BSD partitions and eventually add a swap partition who is not present in the BSD for pi image. I have difficulties to understand Gpart


If you show us the output of `gpart show` if would be easier to give an exact advice.


----------



## covacat (Dec 21, 2021)

don't use swap on a sd card.
does /etc/rc.d/growfs onestart output anything ?
post 
sysctl -b kern.geom.conftxt
mount -p


----------



## Logicien (Dec 21, 2021)

You've got it covacat.

root 00:37 ~ } /etc/rc.d/growfs onestart
Growing root partition to fill device
mmcsd0s2 resized
mmcsd0s2a resized
gpart: arg0 'ufs/rootfs': Invalid argument
super-block backups (for fsck_ffs -b #) at:
 16646016, 17926464, 19206912, 20487360, 21767808, 23048256, 24328704, 25609152, 26889600, 28170048, 29450496
root 00:37 ~ }

After that my root filesystem is of the size of the card. I thank that the fact that growfs was active in /etc/rc.conf would do the job but no. Why no swap partition on an sd card? To save write access?

Thank-you very much.
​


----------



## covacat (Dec 21, 2021)

Logicien said:


> Why no swap partition on an sd card? To save write access?


yes
also mount / with noatime
/dev/ufs/rootfs   /       ufs     rw,noatime      1       1


----------



## Logicien (Dec 21, 2021)

Done.


----------

