From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:5f26::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id sGxULywseGW56AAAkFu2QA (envelope-from ) for ; Tue, 12 Dec 2023 10:47:24 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id AHnPKiwseGX2RwAAqHPOHw (envelope-from ) for ; Tue, 12 Dec 2023 10:47:24 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1702374444; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DU9azQKBs4T2pi5Se2bNryJEK7H/7bEowJCcXVjkjPo=; b=PiP/t0RFavRG0cm+n6KrmMHe95TI1j+uoSHVMdG6U5zKavkN+sJF5dGj6OaXCFOn5+/eng fAJ0k9JPpnrit26kSqcnYEER4LPkRGh3z3ZKLZt86F91Evxzw61dHi6XOj28UEEZHRKNII 7H2pnwOeBGUuRSZmVtlpHAFePyZV8cNe0adpG9ZUHHqvvR5+fXacr9kLPsgr23TrLFQirz WC2o5VfxbRPM5BjmJOsEQk/rrl4upozT+rmdTbZgVOWDDg1RxXqnPgKIfvMv1LXos7XdeL 8aDMkFh1n67TWv4L+ASKNNwiVzTbepi3KvaU7aBUaJPg6aQzLYeVQ7P3xUy6gA== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1702374444; a=rsa-sha256; cv=fail; b=I+d5qbFjgqMt1dVuQy8qXlfly951WY5GyKwepTemt1ePeLVyTP4mZxYcCVxn73CARbJy5N pWOFDiWjwhWKIcBxwmIeLeLg5CNJL+zDuXIruxDk3yaYBXeeGQr47r1BWtpaJx61r6bZaL AUqieYvXutYIYsFGIzAWvCE7pHuSyGLvBHBLkKe/ZqXL4YvxbdW3dkaI+wZT51i5cULOnc 3y1kAkaT4cKbIasJOMLvjWuPFj/ZBJEMFurkmhG2RqT0u84pL+5Qq9Pg/n2YEH83xFJ+AQ dhz0Fp3neZ/5S4A2Rhsr4PbLY2ZI1QQcRnMOS95lVb1wy0qbcPXr/rrU+phVrg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1EEC851D18 for ; Tue, 12 Dec 2023 10:47:23 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rCzLj-0006qz-1j; Tue, 12 Dec 2023 04:46:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rCzLT-0006q7-Hz; Tue, 12 Dec 2023 04:46:34 -0500 Received: from mail-zr0che01on2089.outbound.protection.outlook.com ([40.107.24.89] helo=CHE01-ZR0-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rCzLQ-0001Pm-Hu; Tue, 12 Dec 2023 04:46:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RXkvhFI7a/GnsP55c8ckZXc4OC0u+wfkpFrSpQnp9q7KF3OIN5SsPYWq3yOS/xnIu6a+K1JOre9V1hHN8hEsbPJFWz6/Am3zs1cshDv+L5vgDKIZPeze0C2WinYos75jMTwVAj5uJbc7K2RMrdfY/Ronv6oWBzBekAYen5/THN28ZswZnURd+dk9j0almNSAqO7z/QecQJLDrGyUd3AAyMi+oEd9mXCyMCZKXeA9isSJRxVtmDEjy0FGn/k2ShuA3hvzQ++FOhARrHHrAWR2c+Sd94vOhcx8uJtcW0Vvh8Gil6SFCRMk+GVftzDPml5cYIbw6DbOXEnY9J/QxxThOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4VSD7HELHQQnvSE1tHspBRvwSBXdZ98rnJI9EUdDUZ0=; b=WMtVcqMXvERqsLzsVgd6/gc2bgvq1w98CHG8WlyVbkQqHTZx0RdRGRXKy/nVq5bCExU6oi+6xRQXM4FPUVrBTyrnA5R4unLHMUKA6QaBGpwnPzGjm6Cw5jQ++SBDg5EYQKA4H/V7GtuzD0vclnDPW8Z4e4KDEk2PsDr5zQonFZLB+urzPdynPhG1bBWQPUmJk9o8kCmR7V2jZ1H/knU8aSw2nj42vCpGYVWHh5esrE02yAk9Lj4UMiseeqeOY+xBLj2NDpqNJ01kFzwjTHZALKGxpa9nANRO9K+RW+k6hjNW7FsKTDuMS2Zmuyy7CfDE/+GH03hqGAUq8ekxlBQ7tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=zhaw.ch; dmarc=pass action=none header.from=zhaw.ch; dkim=pass header.d=zhaw.ch; arc=none Received: from ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:25::9) by ZR2P278MB0987.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:61::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33; Tue, 12 Dec 2023 09:46:22 +0000 Received: from ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM ([fe80::e088:2de0:29ae:b97b]) by ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM ([fe80::e088:2de0:29ae:b97b%3]) with mapi id 15.20.7068.033; Tue, 12 Dec 2023 09:46:22 +0000 From: "Wicki Gabriel (wicg)" To: "guix-devel@gnu.org" CC: "help-guix@gnu.org" , Csepp Subject: Re: Resize Filesystem Service Thread-Topic: Resize Filesystem Service Thread-Index: AQHaJsZlR2+ZnU3iCUG3GqX9KnuDzLCZkIeAgAQAHfaAAA4lgIAFKWaAgAKow2Y= Date: Tue, 12 Dec 2023 09:46:22 +0000 Message-ID: References: <87a5qpn2lo.fsf@lease-up.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_Enabled=True; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_SiteId=5d1a9f9d-201f-4a10-b983-451cf65cbc1e; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_SetDate=2023-12-12T09:46:22.385Z; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_Name=Intern; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_ContentBits=0; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_Method=Standard; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: ZR0P278MB0268:EE_|ZR2P278MB0987:EE_ x-ms-office365-filtering-correlation-id: 66e9bbb9-bdac-427c-075f-08dbfaf7334c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VCbWK7HHf2gFN6fJ1KK0+QUyupXI96HUjw2GVsGkFatBs514AsXW2f7mitxp0ikzw6/1yHil2Bg/M3gPXI+pYm1L8ThtiqJwTBKjS0FhBoQ7UyEHkpazKpbbkcD89lSqUEgldssltMfnHV3ktyG1jxBu0Qe8aDNmMrpyCnUid1IxaVMsC8c0i54RrHR/BnISg/7LWQzbTj04LYy0hQ0CXaMd+UC1kzGKOLnMYPJ1F60XEuJOF9XQvhHOfce84Vfawr3EhFfoo+Y+B0TZBt7si/8+KfDIeIj6fzZnZAJMuggn9HbUshhyLtrX9Wkb6pTSFg+8Xm46Hc+TYyHf+KwVXCgSqhXcGjTS9gcglPtxMar8j9vMxgFtlVqePufcwqxNotU0EjgSi3pri8VjEim26TdTGwkyBI5EkX/2pblbxvmAGvxjk+YwVSlNV0cdicaTW7X0yK2IRWbxVEGcbGGKtjMYWritdPhrdbjte9SI67D/2wBynT+pGLii1em0SQT0BRyMVnXjrbLZIBjUWN3SnQp9rl1lvyhFmJqNK11FKH9M1Z9ddPlddiT2fP6QXEE4NzhUJAupScp+5LMniPSZI5cnU3/1JCfhScl7OVyInN8= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(376002)(346002)(366004)(39860400002)(396003)(136003)(230922051799003)(1800799012)(64100799003)(186009)(451199024)(33656002)(38070700009)(19627405001)(55016003)(66899024)(478600001)(26005)(7696005)(966005)(71200400001)(2906002)(8676002)(4326008)(54906003)(7116003)(52536014)(66446008)(6916009)(6506007)(9686003)(8936002)(66476007)(66556008)(64756008)(316002)(786003)(53546011)(83380400001)(3480700007)(41300700001)(5660300002)(76116006)(66946007)(166002)(38100700002)(122000001)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?9zM1Y2A5yPHwDznGMURYugn1K4Ijyk6vw4JQveq8B/f1Xf5n5G4kSvtgUwjY?= =?us-ascii?Q?ZmBtdcy+ZAaWYDzAEcEiQHOMoV3Vzk5oexXzQJzbRBPE4CTkVt+Rp4iYKdBc?= =?us-ascii?Q?riZFAufzCa25euOCqP9m/PGIYKB3al0br1+PvPoKq5NctuVTodMPLlhiwdHN?= =?us-ascii?Q?MDdTjvWqD+W24Zmn7ybV8ojUFc1smPxq8JYpYu3UZP5oNquj8+rS0p+ajB/i?= =?us-ascii?Q?MQmAJ9cHcUFhP3OIwKEc9nM6lZOZilgQ33HSOKPexbSuOKeNwrIJzZveOwow?= =?us-ascii?Q?ypjWo1hreNtx4hBv+gxlAvvf5RTrPRZQ0pONzJH+aMJDIXitveltld07FMjR?= =?us-ascii?Q?TArsnMcwZTwvtRqOCI1RwK9gh52XacNesvQTuKJpiSwYhQVSBb+OHAGgEacP?= =?us-ascii?Q?UbPpHr41Cf0sVr09BZ8mcZVcOn49PU+BpOpVaJHY7PT/1pe360cBuuqUX1cJ?= =?us-ascii?Q?91a2WLNzTWPlITtFz27o2vsePDETkC8cQLTP1bhAB8SI6TDnox0SLbhg2kjm?= =?us-ascii?Q?AmpjiZWeCB1tKl5EtUy/DOXbjWkGafT6O6CHtTO2RqPOavXqQDrJHkmlbrxn?= =?us-ascii?Q?or6FC9WnpPD8eV5fe8YSihJ39ZUGTnWzOxR6+lGsmyrl8IKldXpY6J39AySe?= =?us-ascii?Q?ExvA1Q3TQMh0EpvQYZE0Mu/IyMPJbseu9ZgiUjmYPzVTPeXpjMSEYtCmkCZ5?= =?us-ascii?Q?1ivx9AdshhEhNfEEGtI6RIEu4kyXUa3To2LKESpX8nE1nwf3psXJ11hl8JAd?= =?us-ascii?Q?bMvyBsKr1+4gNAk96SQVBDlNF0wg0QdW+L8cq1ha8v/kCvW2nd5ogGRq9bLW?= =?us-ascii?Q?+ruOGlaOnyY82zTuUEnTOg1a9pbHi2FUgEEKN5W0Q+HRtm7tlbnERW/gJdnQ?= =?us-ascii?Q?aH3oScnaU6NP2o1YlWwlJ2BK3EVvycAzaQ+jPoLQqqwgb47XC47/JaqDzrdl?= =?us-ascii?Q?vgW6uqKvhJTahmO7m1X4mPMz2xaoOBwBtR3ynzDcENV4z4XFHN/F+gEc7jNf?= =?us-ascii?Q?Sk2c/XI/TAIaxdqq/OXFSdYDF4j0mkLKjzxQW1avK1nuFuSbozKVFrbBzwf+?= =?us-ascii?Q?nHkpQsLrOj+I1oHj2NSGSlwd5U9j0ZHgMwh0ol3nub1N7VlcJXGLuZvEN5EX?= =?us-ascii?Q?ZzEed40oryKGvxYPzDjD69Kbj4ZFRYuSXPmINPp0dxHGG+5SyBHTmRhygCpd?= =?us-ascii?Q?8Jq5PACzRImETDbZWERPzIIyAWWd1pv7bRwbE7dlrnysD+FMGPR1XxViBIuV?= =?us-ascii?Q?OCXMO1iHD+lWzQWxBhcOnoOtf9X0mVNzel9FVRgDCTcy55Ycq/xrnqqGn3LC?= =?us-ascii?Q?lHNTxENyBrNskt2JXb+x9+FvODM9OaDQS7g3sFtPnaJA4F7zIv68Hgwn0icM?= =?us-ascii?Q?DJ350UkQZv/wE6SeaAEN2GWx5brAClOcCSZrNyZJGS0h8kqwvhY/1X7UF633?= =?us-ascii?Q?FiuAxoQiFB7foXxe7ITzvOkWnlOfxSrw31Y8ZlZS/eWvLPxpIimC9EQj+K2u?= =?us-ascii?Q?NEioiUqXp54l1V9KNx8Q3pJ5j3Hf1ah7+KmtEw89ZBmFQbmlKgmI/4gcNA?= =?us-ascii?Q?=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: zhaw.ch X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 66e9bbb9-bdac-427c-075f-08dbfaf7334c X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2023 09:46:22.7109 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5d1a9f9d-201f-4a10-b983-451cf65cbc1e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: C9KSslqMONrw0BDwNAHulYyRyITGwXzvI4x4buaTPC6bwQ/bxGgidaC2vWllNqwv X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZR2P278MB0987 Received-SPF: pass client-ip=40.107.24.89; envelope-from=wicg@zhaw.ch; helo=CHE01-ZR0-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -0.41 X-Spam-Score: -0.41 X-Migadu-Queue-Id: 1EEC851D18 X-Migadu-Scanner: mx11.migadu.com X-TUID: oChsG1IGsTfQ Would you mind giving my previously attached service a try and tell me whet= her this works? If there is no other input I will just prepare a patch where the service re= nders a bash script which (somewhat stupidly) attempts to resize the file-s= ystem at (every!) boot - mostly because I'm not sure whether we have the fa= cilities to (or I wouldn't know how) 1. run a service once per system generation (or some other measure) and 2. to construct such a Shell-script in a more verifiable or maintainable= fashion in Guile (though I'd be willing to write relevant helper functions= ) Thanks for all your input! If there is no more input I'll just prepare som= e patch from the existing service. P.S. Since this isn't a classic "help" problem anymore I'm moving the discu= ssion over to the devel-list. ________________________________ From: Csepp Sent: Sunday, December 10, 2023 6:03 PM To: Efraim Flashner Cc: Wicki Gabriel (wicg) ; help-guix@gnu.org Subject: Re: Resize Filesystem Service #+OPTIONS: html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil= tex:dvipng d:nil #+STARTUP: hidestars indent inlineimages :PROPERTIES: :reply-to: nil :attachment: nil :alternatives: (utf-8) :END: Efraim Flashner writes: > [[PGP Signed Part:Undecided]] > On Thu, Dec 07, 2023 at 09:25:43AM +0000, Wicki Gabriel (wicg) wrote: >> Hi >> >> Thanks for the input, Felix. I finally managed to get it to work (with >> additional input from ludo). I attach the service to this mail. If peopl= e >> think this might be a nice-to-have in upstream guix i'll happily craft a >> patch. >> >> g >> ________________________________ >> From: Felix Lechner >> Sent: Monday, December 4, 2023 9:18 PM >> To: Wicki Gabriel (wicg) ; help-guix@gnu.org >> Subject: Re: Resize Filesystem Service >> >> Hi Gabriel, >> >> On Mon, Dec 04 2023, Wicki Gabriel wrote: >> >> > I crafted the service in the file attached but this doesn't work and i >> > neither know where to look nor how to debug the issue. >> >> Writing services is probably more complex than it should be, but it can >> be done. >> >> Please have a look at the cachefilesd-service [1] which I wrote together >> with Bruno Victal (mirai) and which was accepted, or the Heimdal >> Kerberos services that are still waiting for review. [2] >> >> My most immediate suggestion is that I would use define-configuration >> even when no serialization (which helps write configuration files) is >> needed. Also, you have to think carefully about where to place the >> G-Expressions, which can be tough to wrap your mind arround. Finally, I >> would use "file-append" instead of string-append for some of the >> configurable executable paths. >> >> Kind regards >> Felix >> >> [1] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/linux.s= cm#n492 >> [2] https://issues.guix.gnu.org/67555 > >> (define-module (services resize-fs) >> #:use-module (guix gexp) >> #:use-module (guix records) >> #:use-module (gnu packages bash) >> #:use-module (gnu packages disk) ; parted >> #:use-module (gnu packages linux); e2fsprogs >> #:use-module (guix build utils) >> #:use-module (guix packages) >> #:use-module (gnu services) >> #:use-module (gnu services configuration) >> #:use-module (gnu services shepherd) >> #:export (resize-fs-configuration >> resize-fs-configuration? >> resize-fs-configuration-parted >> resize-fs-configuration-e2fsprogs >> resize-fs-configuration-device >> resize-fs-configuration-partition >> resize-fs-configuration-end >> resize-fs-service-type)) >> >> (define-configuration/no-serialization resize-fs-configuration >> (parted >> (file-like parted) >> "The parted package to use.") >> (e2fsprogs >> (file-like e2fsprogs) >> "The e2fsprogs package providing the resize2fs utility.") >> (device >> (string "/dev/mmcblk0") ;; #f may be preferrable here to prevent acci= dental resizing of wrong file-system >> "The device containing the partition to be resized.") >> (partition >> (number 2) >> "The partition number that is to be resized.") >> (end >> (string "100%") >> "The end position of the resized partition as understood by the parte= d \ >> utility (e.g. \"100%\", \"500M\" or \"16GiB\").")) >> >> (define (resize-fs-script config) >> (match-record >> config (parted e2fsprogs device partitio= n end) >> (let ((parted-bin (file-append parted "/sbin/parted")) >> (resize2fs (file-append e2fsprogs "/sbin/resize2fs")) >> (device+partition (string-append device "p" (number->string pa= rtition)))) >> (mixed-text-file "resize-fs.sh" >> "#!/bin/sh >> echoerr() { printf \"$*\\n\" >&2 ; } >> >> cmd() { >> " parted-bin " " device " ---pretend-input-tty <> resizepart >> " (number->string partition) " >> Yes >> " end " >> EOF >> } >> >> set -o errexit >> set -o pipefail >> >> echoerr hello from resize-fs script >> >> if cmd; then >> echoerr \"Resizing successful\" >> else >> echoerr \"resize-script returned $?\" >> fi >> ")))) >> >> (define (resize-fs-shepherd-service config) >> "Return a list of for resize-fs-service for CONFIG" >> (let ((resize-script (resize-fs-script config))) >> (shepherd-service >> (documentation "Resize a file-system. Intended for Guix Systems th= at are booted from an image") >> (provision '(resize-fs)) >> (requirement '(user-processes)) >> (one-shot? #t) >> (respawn? #f) >> (start #~(make-forkexec-constructor >> (list #$(file-append bash "/bin/sh") #$resize-script)))))= ) >> >> (define resize-fs-service-type >> (service-type >> (name 'resize-fs) >> (description "Resize a partition.") >> (extensions >> (list >> (service-extension shepherd-root-service-type >> (compose list resize-fs-shepherd-service)))) >> (default-value (resize-fs-configuration)))) > > I think it would be helpful to have upstream. I'm guessing it would be > useful not just on single board computers but also on VPSs and probably > other use cases. > > Not directly related to upstreaming this service, this seems like a > useful service to offer for an 'on first boot' service, or as some sort > of special service to be loaded with 'sudo herd load root'. I tried to write something similar for my VPS but it wasn't working at boot= , although it did if I restarted the service. So I for one would be very grateful if a working resizer service were upstreamed. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:5f26::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id eMpiKNLleWUEzAAAkFu2QA (envelope-from ) for ; Wed, 13 Dec 2023 18:11:46 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id +Hy7JNLleWV5zAAAqHPOHw (envelope-from ) for ; Wed, 13 Dec 2023 18:11:46 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=none; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1702487506; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=4VSD7HELHQQnvSE1tHspBRvwSBXdZ98rnJI9EUdDUZ0=; b=sWZobQVllYi4NwStYHjsNWQVNTd+M+XCZ014kuaGFoGzlDhluweTHTOuXpDmCcL60oYPV6 PnMkU5m92WCkQpcu40qSmcXDQUhvfoIgmh/BLfZIl7IYtaq83A4p2uMllhhzKdVY1A07+8 9cWUUMHeD+tYXJqpoBuWYFCmyMUV4EmNLEnQAa3Q46VyxNdjg1Nnrp/XYvFZYPVZrBiFd8 5okYapkBjiK+aHfHWVofngm1F9PnrcJ/Xy1eWSblLM0Dqp+U5EyZIbQyjU9L8CwDvHW7TA 3jOq306AIzHxMWgtHDefnFQHe2aweDITuQhHITx9IRjXIlGfMkAyR+uPL3yKWQ== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1702487506; a=rsa-sha256; cv=pass; b=XU18gGBNO6adpFK7dx/0C39Y2h7yPyV4/pq/UjyvK8Z7X6pWviZsEZ+ft8bdw/c51VkpOr 42rh8siTpWLC9QtwYHYq510i8nBjSsMhuSnOCgAraSP2JT+pu1+hETg53ANCP+8BYeXvH4 0jypiPa8WgAIhYvdIWYhddDCMp9lCrezLLomIr0d5Tc/TcO780ZrjV9Bf7EErRmU9RyQTb f2Ju7+BIoTtFfzik0nfB+nIknLt0QlsCwk/O9Gnnm/VXEmcJD0mvBpkXngfesIHrjV+VGf 33SsvRn/oMnHIlN8BebsI91a9f5IEU23rD6n6coTWtxuQkPQmccDs9YBSKgdNg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=none; arc=pass ("microsoft.com:s=arcselector9901:i=1") Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 016BD26625 for ; Wed, 13 Dec 2023 18:11:45 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDSlD-0001Xy-Lh; Wed, 13 Dec 2023 12:11:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rCzLT-0006q7-Hz; Tue, 12 Dec 2023 04:46:34 -0500 Received: from mail-zr0che01on2089.outbound.protection.outlook.com ([40.107.24.89] helo=CHE01-ZR0-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rCzLQ-0001Pm-Hu; Tue, 12 Dec 2023 04:46:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RXkvhFI7a/GnsP55c8ckZXc4OC0u+wfkpFrSpQnp9q7KF3OIN5SsPYWq3yOS/xnIu6a+K1JOre9V1hHN8hEsbPJFWz6/Am3zs1cshDv+L5vgDKIZPeze0C2WinYos75jMTwVAj5uJbc7K2RMrdfY/Ronv6oWBzBekAYen5/THN28ZswZnURd+dk9j0almNSAqO7z/QecQJLDrGyUd3AAyMi+oEd9mXCyMCZKXeA9isSJRxVtmDEjy0FGn/k2ShuA3hvzQ++FOhARrHHrAWR2c+Sd94vOhcx8uJtcW0Vvh8Gil6SFCRMk+GVftzDPml5cYIbw6DbOXEnY9J/QxxThOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4VSD7HELHQQnvSE1tHspBRvwSBXdZ98rnJI9EUdDUZ0=; b=WMtVcqMXvERqsLzsVgd6/gc2bgvq1w98CHG8WlyVbkQqHTZx0RdRGRXKy/nVq5bCExU6oi+6xRQXM4FPUVrBTyrnA5R4unLHMUKA6QaBGpwnPzGjm6Cw5jQ++SBDg5EYQKA4H/V7GtuzD0vclnDPW8Z4e4KDEk2PsDr5zQonFZLB+urzPdynPhG1bBWQPUmJk9o8kCmR7V2jZ1H/knU8aSw2nj42vCpGYVWHh5esrE02yAk9Lj4UMiseeqeOY+xBLj2NDpqNJ01kFzwjTHZALKGxpa9nANRO9K+RW+k6hjNW7FsKTDuMS2Zmuyy7CfDE/+GH03hqGAUq8ekxlBQ7tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=zhaw.ch; dmarc=pass action=none header.from=zhaw.ch; dkim=pass header.d=zhaw.ch; arc=none Received: from ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:25::9) by ZR2P278MB0987.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:61::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33; Tue, 12 Dec 2023 09:46:22 +0000 Received: from ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM ([fe80::e088:2de0:29ae:b97b]) by ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM ([fe80::e088:2de0:29ae:b97b%3]) with mapi id 15.20.7068.033; Tue, 12 Dec 2023 09:46:22 +0000 From: "Wicki Gabriel (wicg)" To: "guix-devel@gnu.org" CC: "help-guix@gnu.org" , Csepp Subject: Re: Resize Filesystem Service Thread-Topic: Resize Filesystem Service Thread-Index: AQHaJsZlR2+ZnU3iCUG3GqX9KnuDzLCZkIeAgAQAHfaAAA4lgIAFKWaAgAKow2Y= Date: Tue, 12 Dec 2023 09:46:22 +0000 Message-ID: References: <87a5qpn2lo.fsf@lease-up.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_Enabled=True; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_SiteId=5d1a9f9d-201f-4a10-b983-451cf65cbc1e; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_SetDate=2023-12-12T09:46:22.385Z; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_Name=Intern; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_ContentBits=0; MSIP_Label_10d9bad3-6dac-4e9a-89a3-89f3b8d247b2_Method=Standard; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: ZR0P278MB0268:EE_|ZR2P278MB0987:EE_ x-ms-office365-filtering-correlation-id: 66e9bbb9-bdac-427c-075f-08dbfaf7334c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VCbWK7HHf2gFN6fJ1KK0+QUyupXI96HUjw2GVsGkFatBs514AsXW2f7mitxp0ikzw6/1yHil2Bg/M3gPXI+pYm1L8ThtiqJwTBKjS0FhBoQ7UyEHkpazKpbbkcD89lSqUEgldssltMfnHV3ktyG1jxBu0Qe8aDNmMrpyCnUid1IxaVMsC8c0i54RrHR/BnISg/7LWQzbTj04LYy0hQ0CXaMd+UC1kzGKOLnMYPJ1F60XEuJOF9XQvhHOfce84Vfawr3EhFfoo+Y+B0TZBt7si/8+KfDIeIj6fzZnZAJMuggn9HbUshhyLtrX9Wkb6pTSFg+8Xm46Hc+TYyHf+KwVXCgSqhXcGjTS9gcglPtxMar8j9vMxgFtlVqePufcwqxNotU0EjgSi3pri8VjEim26TdTGwkyBI5EkX/2pblbxvmAGvxjk+YwVSlNV0cdicaTW7X0yK2IRWbxVEGcbGGKtjMYWritdPhrdbjte9SI67D/2wBynT+pGLii1em0SQT0BRyMVnXjrbLZIBjUWN3SnQp9rl1lvyhFmJqNK11FKH9M1Z9ddPlddiT2fP6QXEE4NzhUJAupScp+5LMniPSZI5cnU3/1JCfhScl7OVyInN8= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(376002)(346002)(366004)(39860400002)(396003)(136003)(230922051799003)(1800799012)(64100799003)(186009)(451199024)(33656002)(38070700009)(19627405001)(55016003)(66899024)(478600001)(26005)(7696005)(966005)(71200400001)(2906002)(8676002)(4326008)(54906003)(7116003)(52536014)(66446008)(6916009)(6506007)(9686003)(8936002)(66476007)(66556008)(64756008)(316002)(786003)(53546011)(83380400001)(3480700007)(41300700001)(5660300002)(76116006)(66946007)(166002)(38100700002)(122000001)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?9zM1Y2A5yPHwDznGMURYugn1K4Ijyk6vw4JQveq8B/f1Xf5n5G4kSvtgUwjY?= =?us-ascii?Q?ZmBtdcy+ZAaWYDzAEcEiQHOMoV3Vzk5oexXzQJzbRBPE4CTkVt+Rp4iYKdBc?= =?us-ascii?Q?riZFAufzCa25euOCqP9m/PGIYKB3al0br1+PvPoKq5NctuVTodMPLlhiwdHN?= =?us-ascii?Q?MDdTjvWqD+W24Zmn7ybV8ojUFc1smPxq8JYpYu3UZP5oNquj8+rS0p+ajB/i?= =?us-ascii?Q?MQmAJ9cHcUFhP3OIwKEc9nM6lZOZilgQ33HSOKPexbSuOKeNwrIJzZveOwow?= =?us-ascii?Q?ypjWo1hreNtx4hBv+gxlAvvf5RTrPRZQ0pONzJH+aMJDIXitveltld07FMjR?= =?us-ascii?Q?TArsnMcwZTwvtRqOCI1RwK9gh52XacNesvQTuKJpiSwYhQVSBb+OHAGgEacP?= =?us-ascii?Q?UbPpHr41Cf0sVr09BZ8mcZVcOn49PU+BpOpVaJHY7PT/1pe360cBuuqUX1cJ?= =?us-ascii?Q?91a2WLNzTWPlITtFz27o2vsePDETkC8cQLTP1bhAB8SI6TDnox0SLbhg2kjm?= =?us-ascii?Q?AmpjiZWeCB1tKl5EtUy/DOXbjWkGafT6O6CHtTO2RqPOavXqQDrJHkmlbrxn?= =?us-ascii?Q?or6FC9WnpPD8eV5fe8YSihJ39ZUGTnWzOxR6+lGsmyrl8IKldXpY6J39AySe?= =?us-ascii?Q?ExvA1Q3TQMh0EpvQYZE0Mu/IyMPJbseu9ZgiUjmYPzVTPeXpjMSEYtCmkCZ5?= =?us-ascii?Q?1ivx9AdshhEhNfEEGtI6RIEu4kyXUa3To2LKESpX8nE1nwf3psXJ11hl8JAd?= =?us-ascii?Q?bMvyBsKr1+4gNAk96SQVBDlNF0wg0QdW+L8cq1ha8v/kCvW2nd5ogGRq9bLW?= =?us-ascii?Q?+ruOGlaOnyY82zTuUEnTOg1a9pbHi2FUgEEKN5W0Q+HRtm7tlbnERW/gJdnQ?= =?us-ascii?Q?aH3oScnaU6NP2o1YlWwlJ2BK3EVvycAzaQ+jPoLQqqwgb47XC47/JaqDzrdl?= =?us-ascii?Q?vgW6uqKvhJTahmO7m1X4mPMz2xaoOBwBtR3ynzDcENV4z4XFHN/F+gEc7jNf?= =?us-ascii?Q?Sk2c/XI/TAIaxdqq/OXFSdYDF4j0mkLKjzxQW1avK1nuFuSbozKVFrbBzwf+?= =?us-ascii?Q?nHkpQsLrOj+I1oHj2NSGSlwd5U9j0ZHgMwh0ol3nub1N7VlcJXGLuZvEN5EX?= =?us-ascii?Q?ZzEed40oryKGvxYPzDjD69Kbj4ZFRYuSXPmINPp0dxHGG+5SyBHTmRhygCpd?= =?us-ascii?Q?8Jq5PACzRImETDbZWERPzIIyAWWd1pv7bRwbE7dlrnysD+FMGPR1XxViBIuV?= =?us-ascii?Q?OCXMO1iHD+lWzQWxBhcOnoOtf9X0mVNzel9FVRgDCTcy55Ycq/xrnqqGn3LC?= =?us-ascii?Q?lHNTxENyBrNskt2JXb+x9+FvODM9OaDQS7g3sFtPnaJA4F7zIv68Hgwn0icM?= =?us-ascii?Q?DJ350UkQZv/wE6SeaAEN2GWx5brAClOcCSZrNyZJGS0h8kqwvhY/1X7UF633?= =?us-ascii?Q?FiuAxoQiFB7foXxe7ITzvOkWnlOfxSrw31Y8ZlZS/eWvLPxpIimC9EQj+K2u?= =?us-ascii?Q?NEioiUqXp54l1V9KNx8Q3pJ5j3Hf1ah7+KmtEw89ZBmFQbmlKgmI/4gcNA?= =?us-ascii?Q?=3D=3D?= Content-Type: multipart/alternative; boundary="_000_ZR0P278MB0268FD293FEB52837F22105FC18EAZR0P278MB0268CHEP_" MIME-Version: 1.0 X-OriginatorOrg: zhaw.ch X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: ZR0P278MB0268.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 66e9bbb9-bdac-427c-075f-08dbfaf7334c X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Dec 2023 09:46:22.7109 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5d1a9f9d-201f-4a10-b983-451cf65cbc1e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: C9KSslqMONrw0BDwNAHulYyRyITGwXzvI4x4buaTPC6bwQ/bxGgidaC2vWllNqwv X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZR2P278MB0987 Received-SPF: pass client-ip=40.107.24.89; envelope-from=wicg@zhaw.ch; helo=CHE01-ZR0-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Wed, 13 Dec 2023 12:11:01 -0500 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.69 X-Spam-Score: -6.69 X-Migadu-Queue-Id: 016BD26625 X-Migadu-Scanner: mx12.migadu.com X-TUID: wFgmhOA+hgi2 Message-ID: <20231212094622.j8g767YCdGX8svikxPdBZW50nq720-jk1wH8fK-TwqM@z> --_000_ZR0P278MB0268FD293FEB52837F22105FC18EAZR0P278MB0268CHEP_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Would you mind giving my previously attached service a try and tell me whet= her this works? If there is no other input I will just prepare a patch where the service re= nders a bash script which (somewhat stupidly) attempts to resize the file-s= ystem at (every!) boot - mostly because I'm not sure whether we have the fa= cilities to (or I wouldn't know how) 1. run a service once per system generation (or some other measure) and 2. to construct such a Shell-script in a more verifiable or maintainable= fashion in Guile (though I'd be willing to write relevant helper functions= ) Thanks for all your input! If there is no more input I'll just prepare som= e patch from the existing service. P.S. Since this isn't a classic "help" problem anymore I'm moving the discu= ssion over to the devel-list. ________________________________ From: Csepp Sent: Sunday, December 10, 2023 6:03 PM To: Efraim Flashner Cc: Wicki Gabriel (wicg) ; help-guix@gnu.org Subject: Re: Resize Filesystem Service #+OPTIONS: html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil= tex:dvipng d:nil #+STARTUP: hidestars indent inlineimages :PROPERTIES: :reply-to: nil :attachment: nil :alternatives: (utf-8) :END: Efraim Flashner writes: > [[PGP Signed Part:Undecided]] > On Thu, Dec 07, 2023 at 09:25:43AM +0000, Wicki Gabriel (wicg) wrote: >> Hi >> >> Thanks for the input, Felix. I finally managed to get it to work (with >> additional input from ludo). I attach the service to this mail. If peopl= e >> think this might be a nice-to-have in upstream guix i'll happily craft a >> patch. >> >> g >> ________________________________ >> From: Felix Lechner >> Sent: Monday, December 4, 2023 9:18 PM >> To: Wicki Gabriel (wicg) ; help-guix@gnu.org >> Subject: Re: Resize Filesystem Service >> >> Hi Gabriel, >> >> On Mon, Dec 04 2023, Wicki Gabriel wrote: >> >> > I crafted the service in the file attached but this doesn't work and i >> > neither know where to look nor how to debug the issue. >> >> Writing services is probably more complex than it should be, but it can >> be done. >> >> Please have a look at the cachefilesd-service [1] which I wrote together >> with Bruno Victal (mirai) and which was accepted, or the Heimdal >> Kerberos services that are still waiting for review. [2] >> >> My most immediate suggestion is that I would use define-configuration >> even when no serialization (which helps write configuration files) is >> needed. Also, you have to think carefully about where to place the >> G-Expressions, which can be tough to wrap your mind arround. Finally, I >> would use "file-append" instead of string-append for some of the >> configurable executable paths. >> >> Kind regards >> Felix >> >> [1] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/linux.s= cm#n492 >> [2] https://issues.guix.gnu.org/67555 > >> (define-module (services resize-fs) >> #:use-module (guix gexp) >> #:use-module (guix records) >> #:use-module (gnu packages bash) >> #:use-module (gnu packages disk) ; parted >> #:use-module (gnu packages linux); e2fsprogs >> #:use-module (guix build utils) >> #:use-module (guix packages) >> #:use-module (gnu services) >> #:use-module (gnu services configuration) >> #:use-module (gnu services shepherd) >> #:export (resize-fs-configuration >> resize-fs-configuration? >> resize-fs-configuration-parted >> resize-fs-configuration-e2fsprogs >> resize-fs-configuration-device >> resize-fs-configuration-partition >> resize-fs-configuration-end >> resize-fs-service-type)) >> >> (define-configuration/no-serialization resize-fs-configuration >> (parted >> (file-like parted) >> "The parted package to use.") >> (e2fsprogs >> (file-like e2fsprogs) >> "The e2fsprogs package providing the resize2fs utility.") >> (device >> (string "/dev/mmcblk0") ;; #f may be preferrable here to prevent acci= dental resizing of wrong file-system >> "The device containing the partition to be resized.") >> (partition >> (number 2) >> "The partition number that is to be resized.") >> (end >> (string "100%") >> "The end position of the resized partition as understood by the parte= d \ >> utility (e.g. \"100%\", \"500M\" or \"16GiB\").")) >> >> (define (resize-fs-script config) >> (match-record >> config (parted e2fsprogs device partitio= n end) >> (let ((parted-bin (file-append parted "/sbin/parted")) >> (resize2fs (file-append e2fsprogs "/sbin/resize2fs")) >> (device+partition (string-append device "p" (number->string pa= rtition)))) >> (mixed-text-file "resize-fs.sh" >> "#!/bin/sh >> echoerr() { printf \"$*\\n\" >&2 ; } >> >> cmd() { >> " parted-bin " " device " ---pretend-input-tty <> resizepart >> " (number->string partition) " >> Yes >> " end " >> EOF >> } >> >> set -o errexit >> set -o pipefail >> >> echoerr hello from resize-fs script >> >> if cmd; then >> echoerr \"Resizing successful\" >> else >> echoerr \"resize-script returned $?\" >> fi >> ")))) >> >> (define (resize-fs-shepherd-service config) >> "Return a list of for resize-fs-service for CONFIG" >> (let ((resize-script (resize-fs-script config))) >> (shepherd-service >> (documentation "Resize a file-system. Intended for Guix Systems th= at are booted from an image") >> (provision '(resize-fs)) >> (requirement '(user-processes)) >> (one-shot? #t) >> (respawn? #f) >> (start #~(make-forkexec-constructor >> (list #$(file-append bash "/bin/sh") #$resize-script)))))= ) >> >> (define resize-fs-service-type >> (service-type >> (name 'resize-fs) >> (description "Resize a partition.") >> (extensions >> (list >> (service-extension shepherd-root-service-type >> (compose list resize-fs-shepherd-service)))) >> (default-value (resize-fs-configuration)))) > > I think it would be helpful to have upstream. I'm guessing it would be > useful not just on single board computers but also on VPSs and probably > other use cases. > > Not directly related to upstreaming this service, this seems like a > useful service to offer for an 'on first boot' service, or as some sort > of special service to be loaded with 'sudo herd load root'. I tried to write something similar for my VPS but it wasn't working at boot= , although it did if I restarted the service. So I for one would be very grateful if a working resizer service were upstreamed. --_000_ZR0P278MB0268FD293FEB52837F22105FC18EAZR0P278MB0268CHEP_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

If there is no other input I will just prepare a= patch where the service renders a bash script which (somewhat stupidly) attempts to resize the file-system at (ev= ery!) boot - mostly because I'm not sure whether we have the facilities to = (or I wouldn't know how)
  1. run= a service once per system generation (or some other measure) and
  2. to = construct such a Shell-script in a more verifiable or maintainable fashion = in Guile (though I'd be willing to write relevant helper functions)

Thanks for all your input!  If there is no = more input I'll just prepare some patch from the existing service.

P.S. Since this isn't a classic "help"= problem anymore I'm moving the discussion over to the devel-list.

From: Csepp <raingloom@r= iseup.net>
Sent: Sunday, December 10, 2023 6:03 PM
To: Efraim Flashner <efraim@flashner.co.il>
Cc: Wicki Gabriel (wicg) <wicg@zhaw.ch>; help-guix@gnu.org <= ;help-guix@gnu.org>
Subject: Re: Resize Filesystem Service
 
#+OPTIONS: html-postamble:nil H:5 num:nil ^:{} toc= :nil author:nil email:nil tex:dvipng d:nil
#+STARTUP: hidestars indent inlineimages
:PROPERTIES:
:reply-to: nil
:attachment: nil
:alternatives: (utf-8)
:END:

Efraim Flashner <efraim@flashner.co.il> writes:

> [[PGP Signed Part:Undecided]]
> On Thu, Dec 07, 2023 at 09:25:43AM +0000, Wicki Gabriel (wicg) wrote:<= br> >> Hi
>>
>> Thanks for the input, Felix. I finally managed to get it to work (= with
>> additional input from ludo). I attach the service to this mail. If= people
>> think this might be a nice-to-have in upstream guix i'll happily c= raft a
>> patch.
>>
>> g
>> ________________________________
>> From: Felix Lechner <felix.lechner@lease-up.com>
>> Sent: Monday, December 4, 2023 9:18 PM
>> To: Wicki Gabriel (wicg) <wicg@zhaw.ch>; help-guix@gnu.org &= lt;help-guix@gnu.org>
>> Subject: Re: Resize Filesystem Service
>>
>> Hi Gabriel,
>>
>> On Mon, Dec 04 2023, Wicki Gabriel wrote:
>>
>> > I crafted the service in the file attached but this doesn't w= ork and i
>> > neither know where to look nor how to debug the issue.
>>
>> Writing services is probably more complex than it should be, but i= t can
>> be done.
>>
>> Please have a look at the cachefilesd-service [1] which I wrote to= gether
>> with Bruno Victal (mirai) and which was accepted, or the Heimdal >> Kerberos services that are still waiting for review. [2]
>>
>> My most immediate suggestion is that I would use define-configurat= ion
>> even when no serialization (which helps write configuration files)= is
>> needed. Also, you have to think carefully about where to place the=
>> G-Expressions, which can be tough to wrap your mind arround. Final= ly, I
>> would use "file-append" instead of string-append for som= e of the
>> configurable executable paths.
>>
>> Kind regards
>> Felix
>>
>> [1] https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/services/linux.scm#n492=
>> [2] https://issues.g= uix.gnu.org/67555
>
>> (define-module (services resize-fs)
>>   #:use-module (guix gexp)
>>   #:use-module (guix records)
>>   #:use-module (gnu packages bash)
>>   #:use-module (gnu packages disk) ; parted
>>   #:use-module (gnu packages linux); e2fsprogs
>>   #:use-module (guix build utils)
>>   #:use-module (guix packages)
>>   #:use-module (gnu services)
>>   #:use-module (gnu services configuration)
>>   #:use-module (gnu services shepherd)
>>   #:export (resize-fs-configuration
>>           &= nbsp; resize-fs-configuration?
>>           &= nbsp; resize-fs-configuration-parted
>>           &= nbsp; resize-fs-configuration-e2fsprogs
>>           &= nbsp; resize-fs-configuration-device
>>           &= nbsp; resize-fs-configuration-partition
>>           &= nbsp; resize-fs-configuration-end
>>           &= nbsp; resize-fs-service-type))
>>
>> (define-configuration/no-serialization resize-fs-configuration
>>   (parted
>>    (file-like parted)
>>    "The parted package to use.")
>>   (e2fsprogs
>>    (file-like e2fsprogs)
>>    "The e2fsprogs package providing the resize= 2fs utility.")
>>   (device
>>    (string "/dev/mmcblk0") ;; #f may be p= referrable here to prevent accidental resizing of wrong file-system
>>    "The device containing the partition to be = resized.")
>>   (partition
>>    (number 2)
>>    "The partition number that is to be resized= .")
>>   (end
>>    (string "100%")
>>    "The end position of the resized partition = as understood by the parted \
>>   utility (e.g. \"100%\", \"500M\" o= r \"16GiB\")."))
>>
>> (define (resize-fs-script config)
>>   (match-record
>>       config <resize-fs-configura= tion> (parted e2fsprogs device partition end)
>>     (let ((parted-bin (file-append parted &quo= t;/sbin/parted"))
>>           (resiz= e2fs  (file-append e2fsprogs "/sbin/resize2fs"))
>>           (devic= e+partition (string-append device "p" (number->string partitio= n))))
>>       (mixed-text-file "resize-= fs.sh"
>>           &= nbsp;            &qu= ot;#!/bin/sh
>> echoerr() { printf \"$*\\n\" >&2 ; }
>>
>> cmd() {
>>     " parted-bin " " device &qu= ot; ---pretend-input-tty <<EOF && " resize2fs " &qu= ot; device+partition "
>> resizepart
>> " (number->string partition) "
>> Yes
>> " end "
>> EOF
>> }
>>
>> set -o errexit
>> set -o pipefail
>>
>> echoerr hello from resize-fs script
>>
>> if cmd; then
>>   echoerr \"Resizing successful\"
>> else
>>   echoerr \"resize-script returned $?\"
>> fi
>> "))))
>>
>> (define (resize-fs-shepherd-service config)
>>   "Return a list of <shepherd-service> for re= size-fs-service for CONFIG"
>>   (let ((resize-script (resize-fs-script config)))
>>     (shepherd-service
>>      (documentation "Resize a file-s= ystem.  Intended for Guix Systems that are booted from an image")=
>>      (provision '(resize-fs))
>>      (requirement '(user-processes))
>>      (one-shot? #t)
>>      (respawn? #f)
>>      (start #~(make-forkexec-constructor<= br> >>           &= nbsp;    (list #$(file-append bash "/bin/sh") #$re= size-script))))))
>>
>> (define resize-fs-service-type
>>   (service-type
>>    (name 'resize-fs)
>>    (description "Resize a partition.") >>    (extensions
>>     (list
>>      (service-extension shepherd-root-ser= vice-type
>>           &= nbsp;           &nbs= p; (compose list resize-fs-shepherd-service))))
>>    (default-value (resize-fs-configuration))))
>
> I think it would be helpful to have upstream. I'm guessing it would be=
> useful not just on single board computers but also on VPSs and probabl= y
> other use cases.
>
> Not directly related to upstreaming this service, this seems like a > useful service to offer for an 'on first boot' service, or as some sor= t
> of special service to be loaded with 'sudo herd load root'.

I tried to write something similar for my VPS but it wasn't working at boot= ,
although it did if I restarted the service.
So I for one would be very grateful if a working resizer service were
upstreamed.
--_000_ZR0P278MB0268FD293FEB52837F22105FC18EAZR0P278MB0268CHEP_--