From nobody Mon Nov 07 16:10:38 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 4N5bmy38mGz4hKQD for ; Mon, 7 Nov 2022 16:10:42 +0000 (UTC) (envelope-from mike@mail.karels.net) Received: from mail.karels.net (mail.karels.net [216.160.39.52]) by mx1.freebsd.org (Postfix) with ESMTP id 4N5bmw73DGz3bS8; Mon, 7 Nov 2022 16:10:40 +0000 (UTC) (envelope-from mike@mail.karels.net) Received: from mail.karels.net (localhost [127.0.0.1]) by mail.karels.net (8.16.1/8.16.1) with ESMTPS id 2A7GAc9N090049 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 7 Nov 2022 10:10:38 -0600 (CST) (envelope-from mike@mail.karels.net) Received: (from mike@localhost) by mail.karels.net (8.16.1/8.16.1/Submit) id 2A7GAcHl090048; Mon, 7 Nov 2022 10:10:38 -0600 (CST) (envelope-from mike) Message-Id: <202211071610.2A7GAcHl090048@mail.karels.net> To: freebsd-arm@freebsd.org cc: jmg@freebsd.org From: Mike Karels Reply-to: mike@karels.net Subject: adding swap when expanding root filesystem 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-ID: <90046.1667837438.1@mail.karels.net> Date: Mon, 07 Nov 2022 10:10:38 -0600 X-Rspamd-Queue-Id: 4N5bmw73DGz3bS8 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of mike@mail.karels.net has no SPF policy when checking 216.160.39.52) smtp.mailfrom=mike@mail.karels.net X-Spamd-Result: default: False [-1.68 / 15.00]; AUTH_NA(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.98)[-0.977]; FORGED_SENDER(0.30)[mike@karels.net,mike@mail.karels.net]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWO(0.00)[2]; R_DKIM_NA(0.00)[]; R_SPF_NA(0.00)[no SPF record]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; HAS_REPLYTO(0.00)[mike@karels.net]; RCVD_COUNT_THREE(0.00)[3]; ASN(0.00)[asn:209, ipnet:216.160.36.0/22, country:US]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[mike]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; REPLYTO_ADDR_EQ_FROM(0.00)[]; DMARC_NA(0.00)[karels.net]; FROM_NEQ_ENVFROM(0.00)[mike@karels.net,mike@mail.karels.net] X-ThisMailContainsUnwantedMimeParts: N This question is not really arm-specific, but I couldn't think of a better 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 installing, there is no option to add swap space on the install image. I have added swap space on a USB disk, but this is often not an option. It occurred 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 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? Mike