16 down vote accepted

The reason you can't find it is because, for the most part, it's not in the kernel -- it's in the userspace mount utility, which is in the util-linux package. If you don't give it a filesystem type, or if you give it a type of "any", mount merely goes through the list of all of the filesystems the kernel knows about, and tries each one in order until one of them mounts successfully (or returns an error if none of them do).

How does it find out what filesystem types the kernel knows about? It reads the /proc/filesystems file, which walks the file_systems linked list in fs/filesystems.c. When a filesystem driver is loaded, it calls register_filesystem in that same file to add itself to that list. For example, there's a call to register_filesystem in init_ext2_fs in fs/ext2/super.cinit_ext2_fs is the module-init function for the ext2 module.

Some filesystems are noisy and print errors to the kernel debug log when someone tries to mount a device with the wrong filesystem, which is why, for instance, you might see errors about "invalid XFS filesystem" when successfully mounting an ext4 filesystem, if mount happened to try xfs first.

answered Apr 16 '11 at 4:21
hobbs

94.8k10107187
 
2  
And the way the driver knows if it's valid is that most file systems have a "magic number" near the beginning of the partition that it looks for. – Keith Apr 16 '11 at 4:49
    
Thank you, great answer! – sloc Apr 16 '11 at 11:03

Linux filesystem detection的更多相关文章

  1. 转载--linux filesystem structures

    In this article, let us review the Linux filesystem structures and understand the meaning of individ ...

  2. buildroot linux filesystem 初探

    /****************************************************************************** * buildroot linux fi ...

  3. RH033读书笔记(15)-Lab 16 The Linux Filesystem

    Lab 16 The Linux Filesystem Goal: Develop a better understanding of Linux filesystem essentials incl ...

  4. Linux & Filesystem Hierarchy Standard

    Linux & Filesystem Hierarchy Standard The Filesystem Hierarchy Standard of Linux https://zhuanla ...

  5. Linux filesystem structures.

    1. / – Root Every single file and directory starts from the root directory. Only root user has write ...

  6. Linux filesystem

    文件系统的运作与操作系统的文件数据有关.较新的操作系统的文件数据除了文件实际内容外,通常含有非常多的属性,例如Linux操作系统的文件权限(rwx)与文件属性(属主.属组.时间参数等).文件系统通常会 ...

  7. Linux 基础

    命令说明 $ type cmd # 获取命令类型 $ which cmd # 命令的位置 $ help cmd / cmd --help / man cmd # 获取命令帮助 $ whatis cmd ...

  8. Oracle Linux 5.7安装VMware Tools的问题

    案例环境介绍:     虚拟机的版本:VMware® Workstation 8.0.3 build-703057    操作系统版本:Oracle Linux Server release 5.7 ...

  9. Linux File Recovery Study

    Background Today I did stupid things that I went into the ~/Downloads/ and pressed [Alt] + [A] then ...

随机推荐

  1. python: HTML之 鼠标放上去下拉项字体显示不同颜色

    鼠标放上去下拉项字体显示不同颜色 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "h ...

  2. android界面横屏和竖屏的切换

    关于android横屏和竖屏的切换网上给了很多种.但是有些介绍的方法都是在android旧版本上. 我现在把握用到的情况写下来用于备忘: android 版本:4.0 - 4.4 要求:android ...

  3. hibernate的二级缓存

    缓存(Cache): 计算机领域非常通用的概念.它介于应用程序和永久性数据存储源(如硬盘上的文件或者数据库)之间,其作用是降低应用程序直接读写永久性数据存储源的频率,从而提高应用的运行性能.缓存中的数 ...

  4. Tsung安装与使用

    Tsung安装与使用 Tsung安装与使用的详细说明,包括测试场景的脚本配置说明 Ray 2013/11/11   目录 安装tsung Tsung运行环境安装... Tsung安装... 使用Tsu ...

  5. 【leetcode❤python】 190. Reverse Bits

    #-*- coding: UTF-8 -*- class Solution:    # @param n, an integer    # @return an integer    def reve ...

  6. oracle组查询

    概念: 所谓组查询即将数据按照某列或者某些列相同的值进行分组,然后对该组的数据进行组函数运用,针对每一组返回一个结果. note: 1.组函数可以出现的位置: select子句和having 子句 2 ...

  7. Moving From Top To Bottom in Detailed Block in Oracle Forms

    Suppose you want to scan a tabular grid block (loop through all records in detail block) from top to ...

  8. 【Todo】【读书笔记】机器学习-周志华

    书籍位置: /Users/baidu/Documents/Data/Interview/机器学习-数据挖掘/<机器学习_周志华.pdf> 一共442页.能不能这个周末先囫囵吞枣看完呢.哈哈 ...

  9. 项目打包文件build.xml

    Make命令其实就是一个项目管理工具,而Ant所实现功能与此类似.像make,gnumake和nmake这些编译工具都有一定的缺陷,但是Ant却克服了这些工具的缺陷.最初Ant开发者在开发跨平台的应用 ...

  10. SPSS数据分析—最小一乘法

    线性回归最常用的是以最小二乘法作为拟合方法,但是该方法比较容易受到强影响点的影响,因此我们在拟合线性回归模型时,也将强影响点作为要考虑的条件.对于强影响点,在无法更正或删除的情况下,需要改用更稳健的拟 ...