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

最新文章

  1. .Net 分布式云平台基础服务建设说明概要
  2. sql 批量插入数据到Sqlserver中 效率较高的方法
  3. history对象的一些知识点
  4. 旋转轮子 UIActivityIndicatorView
  5. php解析一个url
  6. JVM学习---JAVA内存
  7. node.js:怎样同时执行多条SQLs,且只有一个回调
  8. redhat系统安装部署
  9. 对openflow 1.0协议的扩展
  10. Asp.Net构架(Http请求处理流程)、Asp.Net 构架(Http Handler 介绍)、Asp.Net 构架(HttpModule 介绍)
  11. hdu4185+poj3020(最大匹配+最小边覆盖)
  12. Flash-使用变形面板制作花朵
  13. Django框架中的视图和模板
  14. Shell脚本编程学习入门 02
  15. ES6(数值)
  16. Revit 命令添加下拉框
  17. OpenTSDB/HBase的调优过程整理
  18. 使用 Nginx 为 Linux 实例绑定多个域名
  19. 在jsp的js和css里面使用EL表达式取值|style里面用$取值
  20. URL中的空格

热门文章

  1. LINK : fatal error LNK1104: 无法打开文件“LIBCD.lib”
  2. if 语句运用
  3. 解决GitLab提交MergeRequest时,提示502 GitLab is not responding.的问题
  4. GZFramwork数据库层《三》普通主从表增删改查
  5. 微信小程序配置文件
  6. spm总结
  7. C#高级进阶--重写函数
  8. html知识2
  9. 开发实时壁纸(Live Wallpapers)
  10. stage simulator