Can I list the filesystems a running kernel can support?
Solution 1
Can I list the filesystems a running kernel can support?
Well, answer /proc/filesystems
is bluntly wrong — it reflects only those FSes that already were brought in use, but there are way more of them usually that kernel can support:
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), but a snapshot of config used to build the kernel typically can be found in the boot directory along with kernel and initrd images.
Solution 2
/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.
Solution 3
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.
Solution 4
tl;dr
cat /proc/filesystems
will show you which filesystems your running kernel can support right now.
ls /lib/modules/$(uname -r)/kernel/fs
will provide clues as to which additional filesystems it could support, if you loaded the appropriate module.
Explanation
The question has already been answered, but all of the other answers are in some way incomplete, misleading, untrue, or at least not true any more.
From man 8 mount
(emphasis mine):
-t, --types fstype
The argument following the -t is used to indicate the filesystem type. The filesystem types which are currently supported depend on the running kernel. See /proc/filesystems and /lib/modules/$(uname -r)/kernel/fs for a complete list of the filesystems. The most common are ext2, ext3, ext4, xfs, btrfs, vfat, sysfs, proc, nfs and cifs.
I therefore can't fault anyone suggesting these approaches. However, as others have pointed out, the /lib/modules/$(uname -r)/kernel/fs
directory contains filesystem-related kernel modules, which is not the same thing as currently supported filesystems:
- If the module is not loaded, the filesystem will not be supported currently.
- If support is built-in to the kernel, the filesystem will be supported but won't show up in the list of modules.
- Module names are not guaranteed to map 1:1 to the filesystems they support.
The list can therefore contain additions, deletions and/or substitutions. It's not very reliable. It's possible to have a so-called "monolithic kernel" which has everything built-in already - in that (admittedly unusual) case the module list will be completely empty but the kernel will still support an arbitrary number of things - including, of course, various filesystems.
On the other hand, this is the contents of my /proc/filesystems
file:
nodev sysfs
nodev tmpfs
nodev bdev
nodev proc
nodev cgroup
nodev cgroup2
nodev cpuset
nodev devtmpfs
nodev binfmt_misc
nodev configfs
nodev debugfs
nodev tracefs
nodev securityfs
nodev sockfs
nodev bpf
nodev pipefs
nodev ramfs
nodev hugetlbfs
nodev rpc_pipefs
nodev devpts
ext3
ext4
ext2
cramfs
squashfs
vfat
msdos
exfat
iso9660
nodev nfs
nodev nfs4
nodev nfsd
nodev cifs
nodev smb3
ntfs3
nodev autofs
fuseblk
nodev fuse
nodev fusectl
udf
f2fs
nodev efivarfs
nodev mqueue
nodev resctrl
btrfs
nodev pstore
There are filesystems in that list that my system has never even seen, let alone has currently mounted.
So on my system at least, that's the answer. I can't speak to why the currently accepted answer leads with the opposite conclusion; perhaps this is a new development...
Oli
Updated on September 18, 2022Comments
-
Oli over 1 year
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).
-
Totor over 2 yearsThe list of supported filesystems for a given running kernel can be seen with
cat /proc/filesystems
as pointed out in the kernel documentation. There may be modules, available on your hard drive, which support other additional filesystems, but that are not loaded into your running kernel. Those can be found in/lib/modules/$(uname -r)/kernel/fs
.
-
-
slm over 10 yearsWhat does the
nodev
mean in the output when youcat /proc/filesystems
? -
Admin over 10 yearsOn 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? -
Jonathan Callen over 10 years
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. -
Oli over 10 yearsUbuntu's kernel config is included, just in a different place:
/boot/config-$(uname -r)
-
poige over 10 years@Oli, I know, but /proc/config.gz is preferable since it's hard-compiled in.
-
Oli over 10 yearsEither way, how would you suggest using the config to list available filesystems? It doesn't appear to be grouped... Is there some way of summarising it by subject? Sort of how
make menuconfig
does... -
poige over 10 years@Oli, well, mine (/proc/config.gz) does: dpaste.com/1440062/plain
-
hayath786 over 10 years
/proc/filesystems
is not wrong, it is just incomplete. -
poige over 10 years@scai, I could say that it's so terrible incomplete that it's simply wrong, but instead I'd rather note, that it's simply wrong since it doesn't answer the question right. Don't bother further.
-
poige over 10 years@Patrick, that's why I gave
/proc/config.gz
which you seem to have overlooked in vain. -
clerksx over 10 yearsThis 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.
-
phemmer over 10 years@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. -
Jürgen A. Erhard over 2 years"there're". Don't do that. And it's "way more", not "a way more".
-
Jürgen A. Erhard over 2 yearsI don't know why your system shows filesystems in /proc/filesystem that the system has never seen, but… I just tried it, not "btrfs" in /proc/filesystems, after "modprobe btrfs" it's in there. I suspect that, for some reason, your kernel has all those filesystems built in and not as loadable modules.
-
tlloyd87 over 2 yearsMy kernel probably does have all those filesystems builtin, as I configure it myself (due to being a masochist) and it's mostly monolithic. I've amended my tl;dr to clarify the role of loadable modules. Other than cluttering up my nice short lsmod output, that is ;)
-
Jürgen A. Erhard over 2 yearsHehe… I very recently built my own kernel (package, for Devuan). First time in years… all due to the new NTFS3 fs driver, which isn't (or at least wasn't at the time) activated in the Debian/Devuan kernel package.