From nobody Tue Nov 08 17:26:51 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 4N6FQX4mhnz4Ydhj for ; Tue, 8 Nov 2022 17:27:00 +0000 (UTC) (envelope-from mike@karels.net) Received: from mail.karels.net (mail.karels.net [216.160.39.52]) by mx1.freebsd.org (Postfix) with ESMTP id 4N6FQX1Tdlz49QM; Tue, 8 Nov 2022 17:27:00 +0000 (UTC) (envelope-from mike@karels.net) Authentication-Results: mx1.freebsd.org; none Received: from mail.karels.net (localhost [127.0.0.1]) by mail.karels.net (8.16.1/8.16.1) with ESMTP id 2A8HQpOU001426; Tue, 8 Nov 2022 11:26:52 -0600 (CST) (envelope-from mike@karels.net) Received: from [10.0.2.130] ([10.0.1.1]) by mail.karels.net with ESMTPSA id sD+nH1uRamOQBQAA4+wvSQ (envelope-from ); Tue, 08 Nov 2022 11:26:51 -0600 From: Mike Karels To: Ronald Klop Cc: jmg@freebsd.org, freebsd-arm@freebsd.org Subject: Re: adding swap when expanding root filesystem Date: Tue, 08 Nov 2022 11:26:51 -0600 X-Mailer: MailMate (1.14r5921) Message-ID: <7DAEBB8E-6B50-453F-B858-5354FA19DE47@karels.net> In-Reply-To: <95847460.127804.1667908570062@localhost> References: <202211071610.2A7GAcHl090048@mail.karels.net> <95847460.127804.1667908570062@localhost> 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=UTF-8 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mail.karels.net id 2A8HQpOU001426 X-Rspamd-Queue-Id: 4N6FQX1Tdlz49QM X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:209, ipnet:216.160.36.0/22, country:US] X-ThisMailContainsUnwantedMimeParts: N On 8 Nov 2022, at 5:56, Ronald Klop wrote: > Van: Mike Karels > Datum: maandag, 7 november 2022 17:10 > Aan: freebsd-arm@freebsd.org > CC: jmg@freebsd.org > Onderwerp: adding swap when expanding root filesystem >> >> This question is not really arm-specific, but I couldn't think of a be= tter >> mailing list for it. >> >> There are peridic issues reported on small systems like Raspberry Pi >> where people are running buildworld or poudriere and running out of >> memory. As the user gets no control over the disk layout when install= ing, >> there is no option to add swap space on the install image. I have add= ed >> swap space on a USB disk, but this is often not an option. It occurre= d >> to me that it might be reasonable to add swap space before expanding >> the root filesystem if there is sufficient space. 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. >> >> The current prototype creates a swap partition which is 1/10 of the di= sk >> if the disk is at least 15 GB and the initial root partition is no mor= e >> 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? >> >> Mike >> > > > Hi, > > Would you mind sharing your prototype? I=E2=80=99ll send you a pointer. If anyone else wants to check it out, l= et me know. It is full of debug prints still, and missing some required changes. It is somewhat tested with MBR, not with GPT. If anyone has a setup to test with GPT, I=E2=80=99d be grateful. I haven=E2=80=99t= tested with ZFS either, although that part shouldn=E2=80=99t require changes. Responding to some earlier comments: - The current limit on swap partition size is 1.5x physmem, as mentioned. I am considering raising it, but I don=E2=80=99t think I want to go beyon= d 2x. - I am considering whether to allow the size to be overridden from kenv and maybe /etc/rc.conf, including a value to disable. Right now it is possible to disable via kenv (untested). - I agree that not everyone needs swap space; that=E2=80=99s true of =E2=80= =9Cnormal=E2=80=9D installs too, which pick a default but allow override with manual partitioning. My hope is that it=E2=80=99s a small enough amount that th= e default size isn=E2=80=99t too large a drop in root capacity. Mike > Regards, > Ronald.