Main partition mounted twice

I just installed NixOS for the first time. My goal is just to look around, start configuring things and give NixOS a try. Therefore I went for the Gnome live ISO, clicked through the installer, chose the “no desktop environment” option, let it wipe my whole SSD and create partitions to its liking.

After the installation finished I booted into the system and I noticed something strange. The main partition (/dev/sda2 in my case) is mounted twice. The mount command has this output:

/dev/sda2 on / type ext4 (rw,relatime)
/dev/sda2 on /nix/store type ext4 (ro,relatime)

Now my questions: Is this the expected behavior? Why is /dev/sda2 mounted twice?
Thanks in advance :slight_smile:

This is normal. NixOS uses a bind mount to remount the /nix/store directory as readonly so that only the nix-daemon is allowed to modify it. You can replicate this behavior like this:

mkdir /foo
mount --bind -o ro /foo /foo

And you’ll see that the root disk is “mounted” another time at /foo; but what it really means is that /foo is bind mounted to the same location, so that I could add the ro mount option to that directory specifically.


Thank you very much for your quick reply and your help. I also read about using findmnt instead of mount which makes it clearer than the mount command that this is a bind mount.