!oNSIfazDqEcwhcOjSL:matrix.org

disko

364 Members
disko - declarative disk partitioning - https://github.com/nix-community/disko92 Servers

Load older messages


SenderMessageTime
21 Sep 2024
@matthewcroughan:defenestrate.itmatthewcroughanor do you mean in my PR?15:42:48
@joerg:thalheim.ioMic92I mean the implementation in nixpkgs15:43:25
@joerg:thalheim.ioMic92It's ext4 only afaik15:43:31
@matthewcroughan:defenestrate.itmatthewcroughanwhat does that have to do with disko?15:43:33
@joerg:thalheim.ioMic92https://github.com/NixOS/nixpkgs/blob/636c5a8db5eb31a9ce04d0e75779ab684b0f8ae3/nixos/lib/make-disk-image.nix#L45315:43:57
@matthewcroughan:defenestrate.itmatthewcroughanah okay so make-disk-image from nixpkgs has a complex thing, and my thing is too simple15:44:50
@matthewcroughan:defenestrate.itmatthewcroughanand just using the path-info size is wrong in some way?15:45:01
@joerg:thalheim.ioMic92It's just the raw content and doesn't take into account that filesystem need more data structures for inodes and stuff.15:45:31
@matthewcroughan:defenestrate.itmatthewcroughanI don't actually understand in what way it is wrong to just use the path-info -Sh output though, because it worked in my cases15:45:41
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @joerg:thalheim.io
It's just the raw content and doesn't take into account that filesystem need more data structures for inodes and stuff.
Oh right, so for that I just hardcode a little bit more in, since I was unable to figure that out
15:45:58
@matthewcroughan:defenestrate.itmatthewcroughan I don't think that's a bad approach, to just +10M it 15:46:07
@joerg:thalheim.ioMic92What about filesystem that do compression for example?15:46:35
@joerg:thalheim.ioMic92I was wondering if it wouldn't be better to increase the image everytime we run out of disk space.15:46:59
@matthewcroughan:defenestrate.itmatthewcroughan

What is more unsatisfying:

  • A spare +10M at the end of the image
  • An spare 5G and trial-and-error session that takes 30 minutes to figure out what the imageSize should be
15:47:04
@joerg:thalheim.ioMic92I think most filesystem can be dynamically increased15:47:09
@matthewcroughan:defenestrate.itmatthewcroughan *

What is more unsatisfying:

  • A spare +10M at the end of the image
  • A spare 5G, or a trial-and-error session that takes 30 minutes to figure out what the imageSize should be
15:47:33
@matthewcroughan:defenestrate.itmatthewcroughanIn using disko I just set the imageSize to a large incorrect value since I can't be bothered with the trial-and-error 15:47:52
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @joerg:thalheim.io
I was wondering if it wouldn't be better to increase the image everytime we run out of disk space.
Oh you mean some process inside the builder that identifies that there's no disk space avail, and expands it to fit?
15:48:35
@joerg:thalheim.ioMic92Yes15:48:57
@matthewcroughan:defenestrate.itmatthewcroughanThat's pretty clever, and I wanted to do the same for NixThePlanet VMs lol15:49:02
@matthewcroughan:defenestrate.itmatthewcroughanso if the builder fails, it'll try again until it succeeds, regarding the macos/windows builders not working 100% of the time because mac/win suck15:49:30
@joerg:thalheim.ioMic92It would require filesystem dependent code but we could offer only for selected filesystems in the beginning15:49:32
@matthewcroughan:defenestrate.itmatthewcroughan
In reply to @joerg:thalheim.io
It would require filesystem dependent code but we could offer only for selected filesystems in the beginning
Yeah, right now there isn't any of that, and if there's going to be, we should also make something like disko.image-builder.imageResizeOnFirstBoot or something
15:50:08
@matthewcroughan:defenestrate.itmatthewcroughanRight now I have all this boiler plate in my disko.nix's15:50:41
@matthewcroughan:defenestrate.itmatthewcroughan
  boot.postBootCommands = ''
    # On the first boot, resize the disk
    if [ -f /disko-first-boot ]; then
      set -euo pipefail
      set -x
      # Figure out device names for the boot device and root filesystem.
      rootPart=$(${pkgs.util-linux}/bin/findmnt -n -o SOURCE /)
      bootDevice=$(lsblk -npo PKNAME $rootPart)
      partNum=$(lsblk -npo MAJ:MIN $rootPart | ${pkgs.gawk}/bin/awk -F: '{print $2}')

      # Resize the root partition and the filesystem to fit the disk
      echo ",+," | sfdisk -N$partNum --no-reread $bootDevice
      ${pkgs.parted}/bin/partprobe
      ${pkgs.bcachefs-tools}/bin/bcachefs device resize $rootPart

      # Prevents this from running on later boots.
      rm -f /disko-first-boot
    fi
  '';

15:50:43
@matthewcroughan:defenestrate.itmatthewcroughanbasically stealing the bits from nixpkgs that expand on boot15:50:52
@matthewcroughan:defenestrate.itmatthewcroughan
                  postMountHook = toString (pkgs.writeScript "postMountHook.sh" ''
                    touch /mnt/disko-first-boot
                  '');

15:51:10
@matthewcroughan:defenestrate.itmatthewcroughan *
                  postMountHook = toString (pkgs.writeScript "postMountHook.sh" ''
                    touch /mnt/disko-first-boot
                  '');
15:51:12
@matthewcroughan:defenestrate.itmatthewcroughanLassulus said something about how this shouldn't be a disko feature at all, because of what you're saying about the filesystem specific code15:51:35
@matthewcroughan:defenestrate.itmatthewcroughanbut if we're gonna have to do it for auto calculating the imageSize, this might as well get dealt with at the same time15:52:02

Show newer messages


Back to Room ListRoom Version: 10