1

I'm working on a Linux-like operating system for aarch64, based on a 5.6.4-v8+ kernel for Raspberry Pi 3 (Model B+).

The Kernel configuration options include:

CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y

It is possible to verify that the system is effectively mounted.

dmesg | grep devtmpfs
[0.071] devtmpfs: initialized
[2,653] devtmpfs: mounted

And it can also be confirmed with that the system is mounted on /dev:

df -h
Filesystem Size Used Avail Used%  Mounted on
devtmpfs   424M    0  424M    0%  /dev.

On the other hand, in the file /etc/fstab I have the following line:

devtmpfs   /dev   devtmpfs   mode=0755,nosuid   0   0

I've done the test to remove this line, and the result has been that devtmpfs mounts just as well without any problems in /dev. So it seems that it is not necessary to ask for the file system to be mounted via fstab, since it seems that the kernel takes care of it.

Is it really necessary to include the devtmpfs mount in fstab?

Thank you!

2 Answers 2

2

The kernel does in fact automatically mount devtmpfs to /dev in some scenarios.

If CONFIG_DEVTMPFS_MOUNT is set to y when building the kernel, the resulting kernel will automatically attempt to mount devtmpfs to /dev after mounting a root filesystem - unless the kernel is using an initramfs for the initial root filesystem.

This is entirely optional functionality. You have it on, while Vincent appears to have had it off in their testing. (Or Vincent was using an initramfs.)

See drivers/base/Kconfig for more details.

1

To my knowledge, the kernel does not automatically mount devtmpfs. It has to be done from userspace, either "manually" (one of the start scripts contains something like: mount -t devtmpfs none /dev), or via fstab.

On my custom linux systems (raspberry zero/4, and 86_64), I do not rely on a mounting mechanism based on /etc/fstab. If I remove the command mount -t devtmpfs none /dev from my /etc/profile, my /dev directory remains empty.

So, to answer your question: you do not have to include the devtmpfs mount in fstab, but you (the user, not the kernel) have to mount it yourself.

1
  • It seems that c-x-berger answer (unix.stackexchange.com/a/703096/403135) is correct - the kernel does mount devtmps to /dev. At least in some situations. I can confirm that it does when you are not not using an initramfs. Nov 19, 2022 at 17:22

You must log in to answer this question.

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