From owner-freebsd-arm@freebsd.org Thu Oct 4 11:04:19 2018 Return-Path: Delivered-To: freebsd-arm@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4A8810C8A92 for ; Thu, 4 Oct 2018 11:04:19 +0000 (UTC) (envelope-from vdemart@gmail.com) Received: from smtpcmd01217.aruba.it (smtpcmd01217.aruba.it [62.149.158.217]) by mx1.freebsd.org (Postfix) with ESMTP id E7A908FD99 for ; Thu, 4 Oct 2018 11:04:18 +0000 (UTC) (envelope-from vdemart@gmail.com) Received: from macbookvittorio.homenet.telecomitalia.it ([82.61.157.83]) by smtpcmd01.ad.aruba.it with bizsmtp id jP181y00h1oEWVe01P180n; Thu, 04 Oct 2018 13:01:08 +0200 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1283) Subject: Re: Booting the raspberry pi 2 from a usb hd (SOLVED) From: Victor In-Reply-To: Date: Thu, 4 Oct 2018 13:01:08 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: freebsd-arm@freebsd.org X-Mailer: Apple Mail (2.1283) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aruba.it; s=a1; t=1538650868; bh=tQ2nd4JJEO3zLK76sZ6C7y4nTsE5i5uT52WXnUBYIUM=; h=Content-Type:Mime-Version:Subject:From:Date:To; b=XmDNPvOBLYtMdVGupAN9ujMOM9Gjr2dA2knACmlZSV6hxQKWJqh6FPfXMCOZCbIXh 558asUzBlJV3s4B4ajdbLtcEAIzl//x+LSzi5OoZRmA0IwbXzHhGfDZV35VTA2/Q2K bRwj6E4zQhx3zT8ojLHp/phlsdcxBH98SNL+WoHiI3agpNAfPL88PTxByx6JK9N43t GfPb2ZNHUurRkqCj0e9EvFZkStI4T/W17rlvcZ26D5ThbuR7MbY5c3MzOCQnipgmA7 iyUiUeqdO+XwJsgTfK/7U4EnFN7CStlt6GuEKDVFVUFV1THkiDEwhClVXmdhSZDl6f I12g6SLZJMl4w== X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Oct 2018 11:04:19 -0000 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