I was going through the Gentoo Handbook in preparation for installing Gentoo on my system.

In the Chrooting section, these commands are given:

mount --rbind /sys /mnt/gentoo/sys
mount --make-rslave /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev
mount --make-rslave /mnt/gentoo/dev

These are the doubts I have regarding this section:

  1. I'm no Linux expert but based on a little digging I did, I found out that a bind mount

    takes an existing directory tree and replicates it under a different point. The directories and files in the bind mount are the same as the original. Any modification on one side is immediately reflected on the other side, since the two views show the same data.

    What I don't understand is, how does making a bind mount in /mnt/gentoo/sys help? The original directory tree is in the installation medium which will be removed. So any changes made in the medium will not be reflected here. What is the purpose of using this command instead of

    mount -t sysfs sysfs /mnt/gentoo/sys 
  2. What is the purpose of using rbind? Assuming that the purpose of the bind mounting was only to create a /sys file on the /mnt/gentoo and not make use of bind mount's reflective feature, why use of rbind? Again, as far as I know, rbind is used when there are mount points under the original directory being bind mounted. But there aren't any mount points under /sys are there?

  • 1
    I think there do exist some other mounts under /sys, even if it don't currently on Gentoo Live, rbind can increase compatibility when Live environment gets updates. Sep 4, 2019 at 5:17

1 Answer 1


1.) /sys is not a real on-disk filesystem: it is a representation of and a means to access kernel internal state in the form of a virtual filesystem. It is entirely RAM-based and there is no point in storing the contents of /sys on disk.

In a certain sense you might say that /sys is regenerated from scratch each time the kernel boots and hardware is detected; in another sense you might say that things in the /sys filesystem don't actually have a permanent existence at all, and are only generated on demand, whenever you attempt to access them, based on the actual kernel state they're supposed to represent.

While you're in the process of installing Gentoo, the new installation does not yet have its own kernel running, so the new installation cannot have its own separate /sys yet. But the installer environment has its own /sys, and making the bind mount makes the "system under construction" borrow the /sys filesystem tree of the installation environment. This makes certain tasks in the installation be exactly the same as when upgrading an existing system, and so the same scripts can be used for both cases: in an upgrade, they are used as-is, but during an installation they just need to be run chrooted to /mnt/gentoo.

2.) Under /sys, there may or may not be debugfs mounted as /sys/kernel/debug, efivarfs UEFI variable store pseudo-filesystem as /sys/firmware/efi/efivars, and a potentially several RAM-based filesystems for the management of various control groups under /sys/fs/cgroup/*.

Under /dev there can be at least /dev/pts, /dev/shm, /dev/hugepages and/or /dev/mqueue, all various special-purpose RAM-based filesystems.

So using rbind will clearly simplify things.

  • 1
    Thanks for the brilliant answer! I have one small doubt: after the installation is completed, installation medium removed, and system rebooted, is the /sys automatically recreated? Sep 4, 2019 at 7:26
  • Yes, just like every time you reboot a Linux system.
    – telcoM
    Sep 4, 2019 at 7:28
  • Are the old /sys files deleted or updated? Sep 4, 2019 at 7:30
  • 1
    /sys is entirely RAM-based, so the "old /sys files" will simply vanish into nothingness when the kernel stops running.
    – telcoM
    Sep 4, 2019 at 7:32
  • This doubt had bugging me for the last two days. Thanks again for clearing it so effectively! Sep 4, 2019 at 7:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .