File system disk layout

riddick 3

由于研究OpenStack的存储,对FS, Disk相关的东西也看了看,有些点以前也有了解,今天发一个总结的 Mindmap 和一些笔记。

先上图,其实还有很多东西没有加入,但是我觉得一个Mindmap太多了会组织不好,就不求高大全了,自己能看懂记得各个点就好:

Brant_Disk_Layout_FS

一看就注意到图里面的VFS!

我以前没有特别关注VFS,看了后, 发现原来跟我们平时的操作太相关太重要了!试想你的系统要是不能mount。。。绝对各种悲催。。。

我简单援引 Wikipedia 的话如下:

A virtual file system (VFS) or virtual filesystem switch is an abstraction layer on top of a more concrete file system. The purpose of a VFS is to allow client applications to access different types of concrete file systems in a uniform way.

VFS既然是FS,就也是有Superblock和iNode的。对于一个 mount 的 FS 来说,Superblock 基本包括:

  • Device: Device identifier for the block device
  • Inode Pointers
  • Blocksize: The block size in bytes of this file system, for example 1024 bytes.
  • Superblock Operations: Amongst other things, these routines are used by the VFS to read and write inodes and superblocks.
  • File System Type
  • File System Specific Information

对于Inode,解释是:

VFS inodes exist only in the kernel’s memory and are kept in the VFS inode cache so long as they are useful to the system.

Inode包括的东西当然就更多:

  • Device: 我认为跟 Superblock 里面的Device是一样的,未确认。
  • Inode number: This is the number of the inode and is unique within this file system.
  • Mode: This field describes what this VFS inode represents as well as access rights to it.
  • User ids
  • Times: The creation, modification and write times.
  • Block size: The size of block for this file in bytes, for example 1024 bytes.
  • Inode Operations: A pointer to a block of routine addresses.
  • Count: The number of system components currently using this VFS inode.
  • Lock: This field is used to lock the VFS inode
  • Dirty: Has this VFS inode been written to, if so the underlying file system will need modifying,
  • File system specific information: 估计跟 Superblock 里面的 File system specific information 也是一样的,未确认。

图里面的最后对 ext2fs 的简要介绍,其实原理跟其他文件系统都是类似,比如通过增大 Block 大小,获得对更大文件的支持;采用更好的算法,让效率得到提升;使用更多的 Double Indirect 和 Triple Indirect 也可以增加对更大文件的支持,想了想还是找个图来更好,如下:

ext2fs_inode

今天的内容其实图里面只是提了冰山一角,因为 FS 真的是好多要学啊~~

页首图片是星际传奇3的海报,我觉得3比2好看。

由于研究OpenStack的存储,对FS, Disk相关的东西也看了看,有些点以前也有了解,今天发一个总结的 Mindmap 和一些笔记。

先上图,其实还有很多东西没有加入,但是我觉得一个Mindmap太多了会组织不好,就不求高大全了,自己能看懂记得各个点就好:

Brant_Disk_Layout_FS

一看就注意到图里面的VFS!

我以前没有特别关注VFS,看了后, 发现原来跟我们平时的操作太相关太重要了!试想你的系统要是不能mount。。。绝对各种悲催。。。

我简单援引 Wikipedia 的话如下:

A virtual file system (VFS) or virtual filesystem switch is an abstraction layer on top of a more concrete file system. The purpose of a VFS is to allow client applications to access different types of concrete file systems in a uniform way.

VFS既然是FS,就也是有Superblock和iNode的。对于一个 mount 的 FS 来说,Superblock 基本包括:

  • Device: Device identifier for the block device
  • Inode Pointers
  • Blocksize: The block size in bytes of this file system, for example 1024 bytes.
  • Superblock Operations: Amongst other things, these routines are used by the VFS to read and write inodes and superblocks.
  • File System Type
  • File System Specific Information

对于Inode,解释是:

VFS inodes exist only in the kernel’s memory and are kept in the VFS inode cache so long as they are useful to the system.

Inode包括的东西当然就更多:

  • Device: 我认为跟 Superblock 里面的Device是一样的,未确认。
  • Inode number: This is the number of the inode and is unique within this file system.
  • Mode: This field describes what this VFS inode represents as well as access rights to it.
  • User ids
  • Times: The creation, modification and write times.
  • Block size: The size of block for this file in bytes, for example 1024 bytes.
  • Inode Operations: A pointer to a block of routine addresses.
  • Count: The number of system components currently using this VFS inode.
  • Lock: This field is used to lock the VFS inode
  • Dirty: Has this VFS inode been written to, if so the underlying file system will need modifying,
  • File system specific information: 估计跟 Superblock 里面的 File system specific information 也是一样的,未确认。

图里面的最后对 ext2fs 的简要介绍,其实原理跟其他文件系统都是类似,比如通过增大 Block 大小,获得对更大文件的支持;采用更好的算法,让效率得到提升;使用更多的 Double Indirect 和 Triple Indirect 也可以增加对更大文件的支持,想了想还是找个图来更好,如下:

ext2fs_inode

今天的内容其实图里面只是提了冰山一角,因为 FS 真的是好多要学啊~~

页首图片是星际传奇3的海报,我觉得3比2好看。

Related posts