Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Oct 2018 13:01:08 +0200
From:      Victor <vdemart@gmail.com>
To:        freebsd-arm@freebsd.org
Subject:   Re: Booting the raspberry pi 2 from a usb hd (SOLVED)
Message-ID:  <BC9AD163-EE6F-4604-816D-6B2DE7BC1A86@gmail.com>
In-Reply-To: <op.zp7x75e9kndu52@sjakie>
References:  <A147F11E-3B87-4CB9-98AB-BC5CFB46C712@gmail.com> <op.zp7x75e9kndu52@sjakie>

next in thread | previous in thread | raw e-mail | index | archive | help

Dear All,
As I pointed out my problem is that I have a postgresql db on my pi2 =
heavily operating in read/write mode and therefore I expect a quick =
deterioration of the sd card.
reading the very fragmented pieces of info on the problem and combining =
them all in the end I found a solution for using a complete =
FreeBSD-armv6-12.0-RPI2-310476 installation (I mean thee root =
filesystem) on  an external usb device connected to my raspberry pi 2.

First of all I specify that the sd card MUST be in the raspberry for the =
very first boot of FreeBSD because the dos programs involved read the =
/etc/fstab and the various loader  files from /dev/mmcsd0s2, that is on =
the sd card itself.=20

This is the procedure to follow:

1) As usual copy the image of file into the sd card via dd which in my =
Mac OS X is called /dev/disk1

sudo dd if =3D FreeBSD-armv6-12.0-RPI2-310476.img of=3D/dev/disk1 bs=3D1M =
conv=3Dsync


2) Start the fresh installation of FreeBSD from the pi2 and verify what =
the external drive is called. In my case /dev/da0. Therefore the root =
filesystem will be in /dev/da0s2a.

3) Modify /etc/fstab in this way:

#/etc/fstab
# Custom /etc/fstab for FreeBSD embedded images
#/dev/ufs/rootfs   /       ufs     rw      1       1
/dev/da0s2a	/	ufs	rw	1	1
/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0
tmpfs /tmp tmpfs rw,mode=3D1777,size=3D50m 0 0

4) Create - because in the stock image there is not such a file - a  =
loader.conf file under the /boot directory with the following content:

#/boot/loader.conf
#Allowance of some more time for the recognition of the usb devices
kern.cam.boot_delay=3D10000=20
#Inform where the root filesystem is
vfs.root.mountfrom=3D"ufs:/dev/da0s2a"

5) Halt FreeBSD remove the sd card and copy it onto the external usb =
drive (/dev/disk2 on my Mac):
=20
sudo dd if =3D /dev/disk1 of=3D/dev/disk2 bs=3D1M conv=3Dsync

6) Insert again the sd card and the usb drive in your pi2 and ....start

Now you are using FreeBSD booted from the sd card but using the root =
filesystem on your external drive for the heavy read/write work!=20
It works like a charm!

Be careful. The external hard drive shouldn't be too demanding in terms =
of electricity for the tiny raspberry. Do not use the "old" external =
hard-disk but the new and more expensive ssd drives. Believe me, in =
spite of the usb 2 the increase in speed is incredible.

Ciao
Vittorio =20












Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BC9AD163-EE6F-4604-816D-6B2DE7BC1A86>