Boot partition and mount point with dual-boot windows

Hi all,

I have seen that the graphical installer, when installing beside windows, only creates a \boot mounting point in the windows boot partition, which is only 100Mo : is it enough for what goes is it ?. Maybe there are some more actions done but it is not mentioned in the summary before launching the proper installation.

My questions, if I want to do it manually :

  • should I only create a mount point /boot in the windows partition ? [/boot or /boot/efi ? ]
  • should I also create a proper separate /boot partition ? But with which mounting point ? /boot/efi for the windows one and /boot for the nix partition one ?

As I understand it, the 100Mb is a windows setting, not from the NixOS graphicaI installer. I created a new 2GB EFI partition and moved the windows files from the original 100Mb partition before going through the process of loading NixOS. As I have a 2Tb SSD in my laptop, the loss of the 100Mb is not a problem (it’s neighbour drive is the main NTFS drive for windows.
Moving the windows files over was not just a simple copy. I made use of google, and found instructions on how to enlarge the EFI partition and how to relocate the Windows system files over.
Good luck, and back up before you start!

Thanks for your answer.

My bad, my EFI partition of windows is 500Mio. It may be sufficient.

Nevertheless, concerning your proposal, I would prefer not touching files from windows, except shrink the C: partition. So I am wondering what is the best way to do it.

So, the best option is to separate /boot from the ESP so that only the boot loader executable itself is on the ESP. This can’t be done with systemd-boot on NixOS until this PR is merged. In the meantime, you can use Grub. You can mount the ESP to its own mountpoint, typically /boot/efi or /efi (I think /efi is generally preferred these days). Grub will read boot files from /boot during boot. Your nixos config should have something like this:

  boot.loader = {
    grub = {
      enable = true;
      device = "nodev";
      efiSupport = true;
    };
    efi = {
      efiSysMountPoint = "/efi";
      canTouchEfiVariables = true;
    };
  };

As for /boot itself, it depends. If you want to switch to systemd-boot when that PR is merged, it needs to be its own partition with the right type code in GPT, formatted with vfat.

But Grub is more flexible. /boot can just be a directory in your regular root fs, or it can be its own partition formatted with any FS that Grub understands. If your root fs is encrypted, then storing /boot on the root fs would require boot.loader.grub.enableCryptodisk = true;, but I strongly recommend against Grub’s LUKS support. Instead, if your root fs is encrypted, I recommend just using an unencrypted separate /boot partition.

So to put it simply: My recommendation is to mount the ESP separately from /boot, setting efiSysMountPoint to match. Enable Grub with efiSupport = true;. There should be a separate vfat partition for /boot, and it should have the GPT partition type code for “Linux extended boot” (as described in the cfdisk TUI) so that you can switch to systemd-boot later when that PR has been merged.

1 Like

Thanks for your precise and concise answer !

For the moment I am in Grub team :wink:

For /efi, it seems so (at least according to Arch manual). But I also see a lot of /boot/efi in tutorials.

Yea, though the “Discoverable Partitions Specification” says to use /efi :slight_smile:

As NixOS will be installed besides windows, you also need osprober for grub to find it right ? So :

  boot.loader = {
    grub = {
      enable = true;
      device = "nodev";
      efiSupport = true;
      useOSProber = true;
    };
    efi = {
      efiSysMountPoint = "/efi";
      canTouchEfiVariables = true;
    };
  };

To find windows? I suppose; I dunno because I don’t use grub. systemd-boot just automatically finds windows if it’s on the same ESP