[PATCH 12/22] host/rootfs: automatically grow user partition

Alyssa Ross
2022-10-10T23:33:01Z

In future, we probably want to make sure we only do this once. I
haven't decided what the best way to do that would be. Since we're
likely going to switch to btrfs anyway for the user partition, it's
probably not worth thinking about too much.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
host/rootfs/default.nix | 10 +++++++---
host/rootfs/etc/s6-rc/ext/up | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index 7932845..0b08603 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -6,7 +6,7 @@
pkgs.pkgsStatic.callPackage (

{ lib, stdenvNoCC, nixos, runCommand, writeReferencesToFile, s6-rc, tar2ext4
-, busybox, cloud-hypervisor, cryptsetup, execline, jq, kmod
+, busybox, cloud-hypervisor, cryptsetup, execline, e2fsprogs, jq, kmod
, mdevd, s6, s6-linux-init, socat, util-linuxMinimal, virtiofsd, xorg
}:

@@ -44,8 +44,8 @@ let
foot = pkgsGui.foot.override { allowPgo = false; };

packages = [
- cloud-hypervisor execline jq kmod mdevd s6 s6-linux-init s6-rc socat
- start-vm virtiofsd
+ cloud-hypervisor e2fsprogs execline jq kmod mdevd s6 s6-linux-init s6-rc
+ socat start-vm virtiofsd

(cryptsetup.override {
programs = {
@@ -57,11 +57,15 @@ let

(busybox.override {
extraConfig = ''
+ CONFIG_CHATTR n
CONFIG_DEPMOD n
CONFIG_FINDFS n
CONFIG_INIT n
CONFIG_INSMOD n
+ CONFIG_LSATTR n
CONFIG_LSMOD n
+ CONFIG_MKE2FS n
+ CONFIG_MKFS_EXT2 n
CONFIG_MODINFO n
CONFIG_MODPROBE n
CONFIG_RMMOD n
diff --git a/host/rootfs/etc/s6-rc/ext/up b/host/rootfs/etc/s6-rc/ext/up
index 4e0b9fc..c189471 100644
--- a/host/rootfs/etc/s6-rc/ext/up
+++ b/host/rootfs/etc/s6-rc/ext/up
@@ -2,4 +2,5 @@
# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>

if { /etc/mdev/wait ext }
+if { resize2fs /dev/ext }
mount /dev/ext /ext
--
2.37.1