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. JAVA基础知识之JDBC——编程步骤及执行SQL

    JDBC编程步骤 下面以mysql数据库为例, 1.加载驱动 首先需要下载数据库的驱动jar文件,并且在eclipse包中加入到class path中去, 例如mysql的驱动文件 mysql-con ...

  2. laravel框架总结(五) -- 服务提供者(提及契约Contracts)

    首先理解两个概念 1.契约:一组定义了框架核心服务的接口 2.服务提供者:所有 Laravel 应用程序启动的中心所在. 包括你自己的应用程序,以及所有的 Laravel 核心服务,都是通过服务提供者 ...

  3. crawler4j源码学习(1):搜狐新闻网新闻标题采集爬虫

    crawler4j是用Java实现的开源网络爬虫.提供了简单易用的接口,可以在几分钟内创建一个多线程网络爬虫.下面实例结合jsoup,采集搜狐新闻网(http://news.sohu.com/)新闻标 ...

  4. FIFO页面置换算法

    本文以序列长度20的{ 7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1};以及页面4:为例: #include <stdio.h> #define Init ...

  5. JDK的安装与配置

    1.什么是JDK(Java Development Kit) 开发工具,javac及基础核心类 运行环境,java及基础核心类 2.目前Java平台的版本 JavaSE(Java Platform S ...

  6. CSS cursor属性

    介绍: 该属性规定要显示的光标的类型,该属性定义了鼠标指针放在一个元素边界范围之内的时候所用的光标的形状. 常用的属性值: default:默认光标 auto:浏览器默认的光标 pointer:光标呈 ...

  7. stm32cube--通用定时器--产生pwm波

    看了通用定时器的资料,发现内容挺多,挺难看懂,现在还是先掌握使用方法,以后再多看几遍吧. ① ② ③生成mdk工程后,在main.c的while(1)前面加上HAL_TIM_PWM_Start(&am ...

  8. zabbix3.0.4 部署之三 (LNMP > Mysql 安装)

    MySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具. 因此,我们首先要在系统中源码编译安装cmake工具. 接下来的安装过程中会遇到错误,我们 ...

  9. 能源项目xml文件 -- app-dubbo.xml

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  10. ASCII十进制字符集

    <script> for(var i=33;i<=6000;i++){ document.write("&nbsp"+i+"&nbsp ...