From nobody Tue Nov 08 04:38:17 2022 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N5wMZ1QNSz4hKcN for ; Tue, 8 Nov 2022 04:38:18 +0000 (UTC) (envelope-from fbsd@www.zefox.net) Received: from www.zefox.net (www.zefox.net [50.1.20.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "www.zefox.com", Issuer "www.zefox.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N5wMY1RwYz3rGB for ; Tue, 8 Nov 2022 04:38:17 +0000 (UTC) (envelope-from fbsd@www.zefox.net) Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of fbsd@www.zefox.net has no SPF policy when checking 50.1.20.27) smtp.mailfrom=fbsd@www.zefox.net; dmarc=none Received: from www.zefox.net (localhost [127.0.0.1]) by www.zefox.net (8.16.1/8.15.2) with ESMTPS id 2A84cI0D055637 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 7 Nov 2022 20:38:18 -0800 (PST) (envelope-from fbsd@www.zefox.net) Received: (from fbsd@localhost) by www.zefox.net (8.16.1/8.15.2/Submit) id 2A84cH5O055636; Mon, 7 Nov 2022 20:38:17 -0800 (PST) (envelope-from fbsd) Date: Mon, 7 Nov 2022 20:38:17 -0800 From: bob prohaska To: Mark Millard Cc: Mike Karels , freebsd-arm@freebsd.org Subject: Re: adding swap when expanding root filesystem Message-ID: <20221108043817.GA55121@www.zefox.net> References: <202211071610.2A7GAcHl090048@mail.karels.net> <20221107175206.GA49113@www.zefox.net> <78C2FBC4-D2CE-44B0-9535-02C0EDECD10A@karels.net> <20221107205150.GA53784@www.zefox.net> <09E80B35-0325-44E6-8191-55DCC79A51F1@yahoo.com> List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <09E80B35-0325-44E6-8191-55DCC79A51F1@yahoo.com> X-Rspamd-Queue-Id: 4N5wMY1RwYz3rGB X-Spamd-Bar: - X-Spamd-Result: default: False [-1.10 / 15.00]; AUTH_NA(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_RHS_WWW(0.50)[]; WWW_DOT_DOMAIN(0.50)[]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; FREEMAIL_TO(0.00)[yahoo.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:7065, ipnet:50.1.16.0/20, country:US]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_NA(0.00)[no SPF record]; RCVD_TLS_LAST(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; RCPT_COUNT_THREE(0.00)[3]; DMARC_NA(0.00)[zefox.net]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Mon, Nov 07, 2022 at 04:07:08PM -0800, Mark Millard wrote: > On Nov 7, 2022, at 12:51, bob prohaska wrote: > > > On Mon, Nov 07, 2022 at 12:47:29PM -0600, Mike Karels wrote: > >> On 7 Nov 2022, at 11:52, bob prohaska wrote: > >> > >>> On Mon, Nov 07, 2022 at 10:10:38AM -0600, Mike Karels wrote: > > [snip] > > > >>>> I have a prototype, > >>>> and wondered if this is a good thing to do. Granted, this will often > >>>> create swap on microSD, which is not optimal, but probably better than > >>>> nothing. > >>>> > > [snip] > > > > Definitely better than nothing. I think it's a good thing to do. > > > >>>> The current prototype creates a swap partition which is 1/10 of the disk > >>>> if the disk is at least 15 GB and the initial root partition is no more > >>>> than 1/3 of the disk, but only up to 1.5x of physical memory. I would > >>>> probably enable this by default, but provide a way to disable it via a > >>>> kenv variable and/or a variable in /etc/rc.conf. > >>>> > >>>> Thoughts? > >>> > > > > "Yes, please!". I'd suggest 2-4x physical RAM rather than 1.5x, > > simply because extra swap is harmless and microSD cards are > > amply large; 64GB was about the smallest readily available > > last time I looked. Now it's probably 128GB. > > > > It might be wise to add a warning about flash wearing out, > > but it took a year of near-continuous buildworlds to kill > > a 128GB microSD holding -current on a Pi3 with ~3 GB swap. > > > > Anything done to make FreeBSD work better on Raspberry Pi > > and competitors is worth a try. Running from microSD isn't > > ideal but does work if used gently. It worked much better > > under armv7. Between aarch64 and growth in compilers > > working swap seems essential now, the more the better. > > > >>> For starters, is there any hope of making bsdinstall run from the > >>> microSD and installing FreeBSD via the traditional process on USB? > > [snip] > >> > >> I think that???s a completely different problem. I suspect that this > >> is already possible, fetching packages over the net, but I don???t > >> know the incantation. Ideally the packages would be local, but then > >> the image would be more like a CD-ROM. It would be nice to have > >> a procedure documented though. > >> > > Since there's a complete system on the microSD can't that be used > > as the initial repository? > > > > I agree it is a different problem in terms of implementation. > > If bsdinstall can format a boot device for Raspberry Pi I should > > give it a try. > > Remember that bsdinstall does not deal with U-Boot > installation in general. Ok, I'll give up hope for now. [snip] > Also the amount of space > U-Boot and the like takes varies. The Rock64 images > use a 16 MiByte space for its U-Boot and the like, > which are stored outside any file system. I'm not sure how anything can be stored "outside any filesystem". Might it be better to say "in a private filesystem", as in not known to the running kernel? Is there any basic problem with automatically establishing a swap partition during a microSD card setup? A trio of self- hosted armv7 Pi2's with swap on microSD have been running happily for over two years as name, mail and webservers on 64 GB cards. Admittely, aarch64 is a lot more swap-intensive, but a Pi3 ran for about a year on a 128 GB card before things started going wrong. That Pi3 was running buildworld most of the time. The Pi2's df outputs are now straddling 50% capacity without any cleanup, so it's probably time to think about upgrading the storage in some way. Treating microSD as a write-once medium isn't outrageous and it may be prudent for shingled mechnical disks. Configuring swap manually on a RPi microSD system is a very considerable amount of work. Having it happen by default wastes at most a few percent of the card capacity. At this point I can't see any reason to say it's a bad idea and have some personal experience to suggest it's a good idea. [bsdinstall limitations snipped] It might be worth mentioning the /boot/loader.conf and /etc/sysctl.conf additions you've mentioned in other threads, as adjuncts to having autoconfigured swap on microSD. They've all been helpful in my experiments on RPi2 and RPi3. I think they'd be constructive additions to the RPi images and perhaps others.. Thanks for reading, and all your help! bob prohaska