I want to change my hardware config from 2 btrfs partitions to 1 partition with subvolumes for root, /nix, /home, and maybe some other like /log.

I mainly want to optimize the /nix/store. And possibly being ready to integrate the impermanence module down the line

What would be the easiest way to accomplish this without reinstalling or breaking too much?

Alternativly I thought about using disko and nixos-install the overwrite my second disk

Thank you

  • Scipitie@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    4 months ago

    Edit: I missed some complexity as suspected! I’m not sure how this process would handle hard and symlinks. Would add an experiment for that before going with the nix and root folders (it shouldn’t harm log at all).

    Original text: Perhaps I’m missing some complexity in your setup but from my understanding it’s really straight forward:

    The main caveat is that you need twice the space of your largest future sub volume. A garbage collect - d and any manual cleanup can help you there. I’d gets that approach with /var/log and when that works move over to the more critical systems.

    • You create the subvolumes within the partition you want to keep.
    • Mount them at a temp location and copy the files over.
    • alter your hardware.nix or whereever you’ve set your mount points to use the subvolume.
    • rebuild switch and reboot.

    If everything is working as expected, write a run book for every step and repeat with /home (i.e. have every step written up). Home is the second least critical folder for this.

    Once you have your runbook repeat the process and when you run out of space resize as needed. (e.g. https://btrfs.readthedocs.io/en/latest/btrfs-filesystem.html#man-filesystem-resize)

    That said: as you aim for the fully ephemeral root I personally would actually go the reibstwllwtion/reinstall route and write up everything I needed to do by hand. But that needs even more spare space (I’d prefer even a second disk for stuff like that to have a fallback).

    Good luck!

    • adept@programming.devOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      4 months ago

      Thanks for your response.

      That’s exactly what i had in mind. I just wasn’t quite sure it would work out as i imagined.

      Since i asked this question i have already prepared a second (empty) disk and a disko config to make it all declarative. Before i actually apply this config to my second disk i’m looking into creating a VM to test the disko-partitions