Wednesday, November 17, 2021

[SOLVED] which one among none/nodev/debugfs shosuld I use to mount debugfs?

Issue

I am trying to enable debug in ath9k kernel driver module.

As debug uses debugfs, I need to mount debugfs. But people and internet are suggesting a little bit differnt mount commnad:

# (Note) mount usage: mount -t type dev dir
mount -t debugfs debugfs /sys/kernel/debug
mount -t debugfs none /sys/kernel/debug
mount -t debugfs nodev /sys/kernel/debug

I am wondering whether all of three commnads have same effect and result. If so, which role does dev in the middle of the command do?

Currently, I think that debugfs is already mounted on my system by typing mount:

/dev/sda1 on / type ext4 (rw,errors=remount-ro)
...
none on /sys/kernel/debug type debugfs (rw)
...
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)

Solution

dev in the middle of the command is the device (eg: /dev/sda1) in case of real filesystems but since this is a virtualized filesystem in RAM it is only necessary to specify the type and the kernel knows what to do next.

According to the official documentation the correct way is this:

mount -t debugfs none /sys/kernel/debug

The details are here: https://www.kernel.org/doc/Documentation/filesystems/debugfs.txt



Answered By - Bogdan