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. css3 calc()方法详解

    calc()对大家来说,或许很陌生,不太会相信calc()是css中的部分.因为看其外表像个函数,既然是函数为何又出现在CSS中呢?这一点也让我百思不得其解,今天有一同事告诉我,说CSS3中有一个属性 ...

  2. Failed to create the part's controls [eclipse]

    查看源码 出现 Failed to create the part's controls 解决方法: eclipse.ini  中添加: -startup plugins/org.eclipse.eq ...

  3. c#委托(1)

    // 委托声明 -- 定义一个签名:delegate double MathAction(double num); class DelegateTest{ // 符合委托声明的常规方法 static ...

  4. MVC 4 用Nuget安装组件后的常见错误

    1,[A]System.Web.WebPages.Razor.Configuration.HostSection 无法强制转换为 [B]System.Web.WebPages.Razor.Config ...

  5. SpringMVC -- 梗概--壹

    1.springMVC:MVC开源框架 2.springMVC开发流程: 2.1 导包: 2.2 配置前端控制器(核心) DispatcherServlet <servlet> <s ...

  6. putty自动登录

    如果没有公钥/密钥对,就用 PuTTYgen 创建一个,已经有了就可以忽略这一步.一个公钥/密钥对可以用在不同的服务器上,所以也不需要重复创建,关键要有足够强健的密码和安全的存放. 象先前一样输入帐户 ...

  7. 樱花漫地集于我心,蝶舞纷飞祈愿相随---总结 适者:survival of the fittest 适者:survival of the fittest

    编程什么的最讨厌了,总是忘记一些乱七八糟的,看起来并没有什么乱用的,比如(::“<>{}, 还有交作业的时候总是忽略大小写<(▰˘◡˘▰)> 马马虎虎莫名其妙就错了,其实大小写 ...

  8. 第三节 构造一个简单的Linux系统MenuOS——20135203齐岳

    第三节 构造一个简单的Linux系统MenuOS By 20135203齐岳 Linux内核源代码 arch/ 支持不同cpu的源代码 Documentations/ 文档存储 init/ 内核启动相 ...

  9. freemarker if elseif

    FreeMarker模板 if, else, elseif 指令 : if, else, elseif 语法 <#if condition> ... <#elseif conditi ...

  10. 不错的TOMCAT监控好工具probe

    Tomcat版本:6.0.41 Probe版本:2.3.3 一,Tomcat没有默认用户账号,故首先需要添加Tomcat用户账号 修改$CATALINA_HOME/conf/tomcat-users. ...