2

In the kernel documentation file "ramfs, rootfs, and initramfs" it says

Rootfs is a special instance of ramfs (or tmpfs, if that's enabled), which is always present in 2.6 systems.

I have not seen rootfs in /proc/mounts on my desktop installations of Linux, but I do see it on my Android phone. Both run Linux 3. Is rootfs still necessary? What is it, too?

  • Read on and you will find notes on initramfs. In most PC distros, people still use initramfs wth some old initrd filename at boot. – Arthur2e5 Oct 26 '15 at 14:44
0

rootfs doesn't show in /proc/mounts - so does this mean the doc out of date? No. See Why is there no rootfs file system present on my system?

As of Linux v4.17, this kernel documentation is still up to date. rootfs is always present; it cannot be unmounted. But a lot of the time you cannot see it in /proc/mounts.

You can see rootfs if you boot into an initramfs shell. If your initramfs is dracut, as in Fedora Linux, you can do this by adding the option rd.break to the kernel command line. (E.g. inside the GRUB boot loader):

switch_root:/# grep rootfs /proc/mounts
rootfs / rootfs rw 0 0

When dracut switches the system to the real root filesystem, you can no longer see rootfs in /proc/mounts. dracut can use either switch_root or systemd to do this. Both of these follow the same sequence of operations, as specified in the linked kernel doc. The operation which hides rootfs is chroot.

switch_root:/# cd /sysroot
switch_root:/sysroot# mount --bind /proc proc
switch_root:/sysroot# grep rootfs proc/mounts
rootfs / rootfs rw 0 0

switch_root:/sysroot# chroot .
sh-4.4# cat proc/mounts
/dev/sda3 / ext4 ro,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0

[...]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.