文件系统
维库,知识与思想的自由文库
计算机的文件系统是一种存储和组织计算机文件和数据的方法,它使得对其访问和查找变得容易。文件系统通常使用硬盘和光盘这样的存储设备,并维护文件在设备中的物理位置。但是,实际上文件系统也可能仅仅是一种访问数据的界面而已,实际的数据是通过网络协议(如NFS、SMB、9P等)提供的或者内存上,甚至可能根本不存在对应的文件(如 proc文件系统)。
严格地说, 文件系统是一套实现了数据的存储、分级组织、访问和获取等操作的抽象数据类型。
目录 |
[编辑] 文件系统概觀
文件系统是一种用于向用户提供底层数据访问的机制。它将设备中的空间划分为特定大小的块(扇区),一般每块512字节。数据存储在这些块中,大小被修正为占用整数个块。由文件系统软件来负责将这些块组织为文件和目录,并记录哪些块被分配给了哪个文件,以及哪些块没有被使用。
不过,文件系统并不一定只在特定存储设备上出现。它是数据的组织者和提供者,至于它的底层,可以是磁盘,也可以是其它动态生成数据的设备(比如网络设备)。
不论文件系统底层是不是存储设备,文件系统都可以把数据组织为文件及目录的形式。文件系统一般会把文件名链接到文件分配表或者某种序列中(MS-DOS的FAT文件系统),或者链接到一个文件链表的节点上(Unix-like文件系统)。目录可以是平的结构,也可以是分层式结构,后者可以在目录中创建子目录。
有的文件系统中,文件名是结构化的,带有文件名扩展信息及版本号等;而另一些文件系统里,文件名只是一个简单的字符串,每个文件的属性信息保存在其它地方。
其它文件保存信息常常伴随着文件自身保存在文件系统中。文件长度也许是分配给这个文件的区块数,也可能是这个文件实际的字节数。文件最后修改时间也许记录在文件的时间戳中。有的文件系统还保存文件的创建时间,最后访问时间及属性修改时间。(不过大多数早期的文件系统不记录文件的时间信息)其它信息还包括文件设备类型(如:区块数,字符集,套接口,子目录等等),文件所有者的ID,组ID,还有访问权限(如:只读,可执行等等)。
The hierarchical file system was an early research interest of Dennis Ritchie of Unix fame; previous implementations were restricted to only a few levels, notably the IBM implementations, even of their early databases like IMS. After the success of Unix, Ritchie extended the file system concept to every object in his later operating system developments, such as Plan 9 and Inferno.
Traditional file systems offer facilities to create, move and delete both files and directories. They lack facilities to create additional links to a directory (hard links in Unix), rename parent links (".." in Unix-like OS), and create bidirectional links to files.
Traditional file systems also offer facilities to truncate, append to, create, move, delete and in-place modify files. They do not offer facilities to prepend to or truncate from the beginning of a file, let alone arbitrary insertion into or deletion from a file. The operations provided are highly asymmetric and lack the generality to be useful in unexpected contexts. For example, interprocess pipes in Unix have to be implemented outside of the file system because the pipes concept does not offer truncation from the beginning of files.
Secure access to basic file system operations can be based on a scheme of access control lists or capabilities. Research has shown access control lists to be difficult to secure properly, which is why research operating systems tend to use capabilities. Commercial file systems still use access control lists. see: secure computing
Arbitrary attributes can be associated on advanced file systems, such as XFS, ext2/ext3, some versions of UFS, and HFS+, using extended file attributes. This feature is implemented in the kernels of Linux, FreeBSD and Mac OS X operating systems, and allows metadata to be associated with the file at the file system level. This, for example, could be the author of a document, the character encoding of a plain-text document, or a checksum.
[编辑] 文件系统的类型
文件系统的类型可以分为磁盘文件系统、网络文件系统和特殊文件系统。
[编辑] 磁盘文件系统
磁盘文件系统是一种设计用来利用数据存储设备来保存文件的文件系统,最常用的数据存储设备是磁盘驱动器,可以直接或者间接地连接到计算机上。例如:FAT、NTFS、HFS、HFS+、ext2、ext3、ISO 9660、ODS-5和UDF。 有些文件系统是 行程文件系统(也有译作日志文件系统)或者 追踪文件系统.
[编辑] 数据库文件系统
文件管理方面的一个新概念是一种基于数据库的文件系统的概念。不再(或者不仅仅)使用分层结构管理,文件按照他们的特征进行区分,如文件类型、专题、作者或者亚数据进行区分。于是文件检索就可以按照SQL风格甚至自然语言风格进行。
例如BFS和WinFS。
[编辑] 事务文件系统
[编辑] 网络文件系统
[编辑] 特殊用途的文件系统
[编辑] 与操作系统的关系
[编辑] 平面文件系统
[编辑] UNIX及UNIX类操作系统下的文件系统
[编辑] Mac OS X 的文件系统
[编辑] Bell实验室的PLAN9文件系统
[编辑] Microsoft Windows的文件系统
[编辑] OpenVMS的文件系统
OpenVMS為Wang Mainframe 所使用的Operation System,以搭配Wang王安博士發明的Magnetic Drum的儲存設備。




