Solved copy freebsd to ssd on rasberry pi 4

SOLVED
I can install Pi OS and use SD Copier to copy to the M.2 SSD and it boots. I can run freebsd RPI successfully on the micro SD. I want to copy the OS from the 32gb micro SD to a 480gb M.2 SSD . I can see the SSD in lsblk. It is da0 the micro SD mmcsd0. I tried using SD copier in pi ubuntu 64 bit from a usb with pi freebsd. I also tried bsdinstall. It recognises the da0 drive. I tried DD but it would not run. Can this be done or will I have to install freebsd in another PC on the m.2 SSD?
 
Last edited:
SOLVED
Well I have worked it out. Downloaded pi imager on pi OS and using freebsd downloaded on desktop of pi os using imager. So let everone know!!
 
The answer to this depends on the filesystem being used. I've been using UFS for / for ever since I started using FreeBSD (2.0.5) in 1995. At some point in the 1990's rather than install a new machine from scratch I started restoring, using dump piped to restore via rsh and later ssh, all my filesystems from one machine to the new machine, simply updating fstab and rc.conf to have a cloned machine with little effort.

My current laptop, which its filesystems trace their lineage back to that day I cloned my now "prod" machine to my laptop, cloned its new 1 TB SSD from 1 TB hard disk using the same basic approach until this last time.

This time around I used gmirror after booting my old hard disk off USB. gmirror create (not gmirror label) allowed me to do the same while multitasking.

ZFS pools are copied using zfs send | zfs receive.

With this last migration I removed the hard disk, installing it into a USB enclosure and installing the new SSD into the laptop. Then boot my FreeBSD off the USB enclosure -- I use UFS labels while ZFS discovers the zpool. I partitioned the new SSD.

I copied the Windows partition using dd(1).

I then removed the USB and booted each partition to make sure each worked, which they did.

The amount of work I had to was minimal. Though it took most of the night (or maybe not, the zfs send | zfs receive probably finished long before I woke) to copy from hard disk to SSD while I slept.

For ZFS I had to export the pool. Then import the new pool using the old pool's name -- renaming pools on import is a handy feature. That had to be done in single user state because the zpool cache file resides in /etc/zfs. I suppose a person could have done this after the export/import and simply copied the file, saving a reboot. Though the approach I took guarantees that the rename will take without unforeseen problems.

Booting each partition, the three FreeBSD partitions first and finally the Windows partition, it's like the laptop never missed a beat.

Because I use this approach, I haven't installed a new FreeBSD from ISO on my physical hardware for a long time. It's the lazy approach and I'd rather it copy my data while I sleep.

BTW, I've used this same approach back in the day for Solaris UFS and Tru64 UFS when migrating or updating those operating systems too. This approach was not initially developed for FreeBSD. We can do the same with Linux albeit boot blocks are handled differently because of GRUB but copying /boot using this approach and Linux's LVM pvmove will work just as effectively. I've used this approach on not just FreeBSD professionally at $JOB for decades. The idea was borne out by the fact that this is how IBM mainframe upgrades or patches operating systems and the first complaint I made to UNIX vendors when my career switched in the 1990's. It's a time saver. On the mainframe we typically clone, then upgrade. Sun developed the boot environment approach initially to address this problem for UFS and later when ZFS was introduced, and now in FreeBSD.

I tend to think my constant griping and complaining to the Sun systems engineers back in the day may have interested someone enough to send the dissatisfaction upstream to their Online Disksuite developers. Then again, maybe not.

The old hard disk was repurposed for backups.
 
I also tried bsdinstall. It recognises the da0 drive.
on Raspberry Pi 4B with 8GB dram memory. Booted from a RPI 14.0-CURRENT Snapshot freebsd.org/where on a USB flash drive. I partitioned an external USB SSD 500GB with gpart partitions UEFI GPT style, aligned on -a 4k or -a 1M 4 kilobyte boundaries to match the SSD 4K byte clusters (not 512 byte clusters any more). had a ethernet network wired interface connected Then used bsdinstall to download and finish the FreeBSD 14.0-CURRENT install to that USB

gpart destroy -F /dev/da0
gpart create -s GPT /dev/da0
gpart add -s 3G -i 1 -t FAT32 -l ESP_EFI_Part /dev/da0 #could get by with 260MB size
mkfs_msdosfs /dev/da0p1
gpart add -s 8G -i 2 -t freebsd-swap -l fbsd_swap /dev/da0
gpart add -s 124G -i 3 -t freebsd-ufs -l fbsd_root /dev/da0
gpart add -s 250G -i 4 -t freebsd-ufs -l fbsd_home /dev/da0

You could use a ZFS file system
gpart add -s 110G -i 5 - t freebsd-zfs -l fbsd_zfs /dev/da0

use zpool create and zfs create command to install files, on that 5th partition

https://ghostbsd-arm64.blogspot.com/2022/09/freebsd-140-compiling-kernel-for.html More details here about configuration

https://www.reddit.com/r/freebsd/comments/v4b5oj/freebsd_on_zfs_on_raspberry_pi/ found this that has the partitioning commands and the ZFS create zrpi

https://github.com/freebsd/freebsd-src/blob/main/usr.sbin/bsdinstall/scripts/zfsboot FreeBSD ZFSboot install script
https://www.reddit.com/r/freebsd/comments/rzh6xh/comment/hrv68l2/ the base script that is improved upon.
 
Back
Top