26

I'm trying to detect what filesystems a kernel can support. Ideally in a little list of their names but I'll take anything you've got.

Note that I don't mean the current filesystems in use, just ones that the current kernel could, theoretically support directly (obviously, fuse could support infinite numbers more).

11

Can I list the filesystems a running kernel can support?

Well, answer /proc/filesystems is simply wrong — it reflects only those FSes that are already brought in use, but there're usually a way more:

ls /lib/modules/$(uname -r)/kernel/fs

Another source is /proc/config.gz which might be absent in your distro (and I always wonder «why?!» in case).

  • 2
    Ubuntu's kernel config is included, just in a different place: /boot/config-$(uname -r) – Oli Nov 3 '13 at 16:21
  • 2
    /proc/filesystems is not wrong, it is just incomplete. – scai Nov 3 '13 at 21:15
  • 3
    @poige By that logic your answer is terribly incomplete and wrong as well. /lib/modules/$(uname -r)/kernel/fs will only help with filesystems that have been enabled as modules, not ones that are built into the kernel. Additionally a module name might not match the filesystem name it provides, and a single module can provide multiple filesystems. – Patrick Nov 4 '13 at 1:42
  • 3
    This answer is misleading, if a module isn't loaded, the kernel simply cannot load that filesystem type until it is. To state that the kernel can load it is not correct -- you don't know if it can until you successfully load the module. There's not even a guarantee that you can load that module. – Chris Down Nov 4 '13 at 7:35
  • 3
    @poige actually I'm not overlooking /proc/config.gz at all. 1) it's not guaranteed to exist, 2) A module name might not match the filesystem name it provides, and a single module can provide multiple filesystems. – Patrick Nov 4 '13 at 12:00
10

/proc/filesystems lists all of the filesystem types supported by the running kernel, along with filesystem attributes, nodev to indicate that this filesystem is not backed by a block device, for example.

man 5 filesystems gives some more in-depth information.

  • 1
    What does the nodev mean in the output when you cat /proc/filesystems? – slm Nov 3 '13 at 14:22
  • On my Arch linux laptop, cat /proc/filesystems lists a bunch of "nodev", obviously special-purpose filesystems, plus ext2, ext3, ext4. When I look in /lib/modules/3.11.6-1-ARCH/kernel/fs, I see a number of others, like "fats", "btrfs", "reiserfs" which are also regular on-disk filesystems, but don't appear in the /proc/filesystem list. What's up with that? – Bruce Ediger Nov 3 '13 at 14:49
  • 1
    nodev indicates that the filesystem in question is not a physical filesystem that needs a block device to live on, but rather a virtual filesystem that is backed by something other than a block device. – Jonathan Callen Nov 3 '13 at 14:49
  • 5
    @BruceEdiger: /proc/filesystems only shows the filesystems that the kernel has loaded -- until you insert those modules into the kernel (which usually happens automatically when you need them), the kernel cannot support those filesystems. – Jonathan Callen Nov 3 '13 at 14:51
0

I believe this will give you what you want:

(cat /proc/filesystems | awk '{print $NF}' | sed '/^$/d'; ls -1 /lib/modules/$(uname -r)/kernel/fs) | sort -u

Explanation

Based on my best understanding:

  • cat /proc/filesystems | awk '{print $NF}' | sed '/^$/d' gives you all the filesystems that are natively supported by the kernel (like sysfs) along with those that have their kernel modules currently loaded
  • ls -1 /lib/modules/$(uname -r)/kernel/fs gives you the list of available filesystem modules available for your kernel
  • sort -u sorts the combined results of the first two commands with duplicates removed (only show unique results -u)

I am still learning linux, this works on Arch linux but I believe for at least ubuntu you may need to change the path /lib/modules/$(uname -r)/kernel/fs to a different directory appropriate for your distribution.

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.