Nested btrfs subvolumes when installing

Hello all!
My goal is to have a btrfs subvolume in a filetree and that should be available before installing.
Something like:

+ /                  btrfs volume
| +var               a directory
  | +lib             a directory
    | +mysql         a subvolume

Is it save to create a directory tree /var/lib and the subvolume before running the installation of the OS? Or is it mandatory to wait until the filetree is created by the OS and then add the subvolumes and rebuild with additional software (i.e. MySQL)?

Feel free to create subvolumes before installation. systemd will automatically correct permissions of directories in /var/lib when necessary.

2 Likes

I see. Looks like filesystem layout is not possible in a declarative way…
Maybe there is no sense in that anyway.
Thank you @xfix for coming out of 11 months of discourse hibernation to answer this:)

fwiw, I’ve been heavily relying on this for a while. In particular for configuring multiple snapshot policies using snapper: nix/machines/Mimir-static.nix · master · Roosemberth Palacios / dotfiles · GitLab

1 Like