From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id 8M+vFz/3dWXekAAAauVa8A:P1 (envelope-from ) for ; Sun, 10 Dec 2023 18:37:03 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 8M+vFz/3dWXekAAAauVa8A (envelope-from ) for ; Sun, 10 Dec 2023 18:37:03 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=riseup.net header.s=squak header.b=BF9oI48m; 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"; dmarc=pass (policy=none) header.from=riseup.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1702229823; 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:dkim-signature; bh=+ZjvIx31rleE/B4KcTMJs3A2uhTXE/zO8v6JpuVyBsg=; b=XoorZADNow06S78V5s+GEGEYxLJfc7mnOaDStD7sVGJDN4ggPjhGntpj0dkKmSPz0SxGkt YSoILzJy+6f8RRXzkSFftG/Pj8CKKNDTJitC9SVuGflEhfIg888+DeikWU/bFaTpa7wmv2 K/9X0hoNLyq6+AYUl3d0ozgwVfgZwDelp19dw7V3VhNS13OAg++fHIvQhZ7VImmw6BSyvD 94jUtDRncCc1kgjxFsYmIe/Iaw95kC7KpPedODVHVTxaNzTaQ0MpE4KZj80V9LX+kVYLp2 95ibXFjswU2gRbWc35RKrvkzt2QP05KZuPv4k/T0vMIHjnM8U3MaFQEpUblLjw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1702229823; a=rsa-sha256; cv=none; b=CQVnoOujmd0lKsYPzI4KnX/5YYVMRJqwukkbqAHLOHBs7O6wF0QgaW+foWO0KGH8FXP9a0 PUDy7sGGOpLVLbPKzftGrL6ub0Ng/3GPtMaSHKHK/aAPfh/+1c/tiArwu24ZXh7MFBq0EE c6d9sK15lJEqv9HJjYuhcHtSYZGSYIXR7vM+OlBxj0cKIjfQ40LD6MfNK0V2+uh0wDMqCh Y9M9ICLk17APBuyA8dBFTZf+VC6E4056YvNTD3j74sBjrmDnaG2Qpz79nme7LR+CAIZpIr PAOZjjvZWRm3Xa2guQxtfPykF7YbFX39KcUugSxL3CDNGkGi5hGiqAHI9cRPEQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=riseup.net header.s=squak header.b=BF9oI48m; 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"; dmarc=pass (policy=none) header.from=riseup.net 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 762C35B465 for ; Sun, 10 Dec 2023 18:37:02 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rCNG9-0006S5-EE; Sun, 10 Dec 2023 12:06:29 -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 1rCNG7-0006Rv-Nx for help-guix@gnu.org; Sun, 10 Dec 2023 12:06:27 -0500 Received: from mx0.riseup.net ([198.252.153.6]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rCNG5-0002O8-HH for help-guix@gnu.org; Sun, 10 Dec 2023 12:06:27 -0500 Received: from fews01-sea.riseup.net (fews01-sea-pn.riseup.net [10.0.1.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx0.riseup.net (Postfix) with ESMTPS id 4SpB9W0lvgz9wx5; Sun, 10 Dec 2023 17:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1702227983; bh=7Sm3ojQwu0ETsYT5dwosUpuX0PwwyFVmqaXJ5diTNpo=; h=From:To:Cc:Subject:Date:References:In-reply-to:From; b=BF9oI48mQo09uPDn9l4YqmiinmOZPaE4eDiBtc2mkhApsSsJMNujK1YJPW0xAcKp8 Qdq59QZyFRtIKk6Ttbzryb43RvAbUVFR2htZjegzSIF0OAXx1olIzdegcc9BUldz02 8olD4IGziEd1+jt44iKrrwz3hTGVeDRl3WIhMioA= X-Riseup-User-ID: 487804F6281ABB64DF89F76D8A11BB1FBFB89988777D73E01690A895074FF08C Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews01-sea.riseup.net (Postfix) with ESMTPSA id 4SpB9V2WXRzJp0l; Sun, 10 Dec 2023 17:06:22 +0000 (UTC) From: Csepp To: Efraim Flashner Cc: "Wicki Gabriel (wicg)" , help-guix@gnu.org Subject: Re: Resize Filesystem Service Date: Sun, 10 Dec 2023 18:03:59 +0100 References: <87a5qpn2lo.fsf@lease-up.com> In-reply-to: Message-ID: MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=198.252.153.6; envelope-from=raingloom@riseup.net; helo=mx0.riseup.net X-Spam_score_int: -37 X-Spam_score: -3.8 X-Spam_bar: --- X-Spam_report: (-3.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, 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-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: -3.71 X-Spam-Score: -3.71 X-Migadu-Queue-Id: 762C35B465 X-Migadu-Scanner: mx11.migadu.com X-TUID: AqH7ZTNorbs3 #+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 people >> 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.scm#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 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\" or \"16GiB\").")) >> >> (define (resize-fs-script config) >> (match-record >> config (parted e2fsprogs device partition end) >> (let ((parted-bin (file-append parted "/sbin/parted")) >> (resize2fs (file-append e2fsprogs "/sbin/resize2fs")) >> (device+partition (string-append device "p" (number->string partition)))) >> (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 that 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.