a file system
© 2010, 2011, 2012 Dennis Leeuw dleeuw at made-it dot com
License: GPLv2 or later
Since the Linux kernel supports a lot of different filesystem types, there needs to be some sort of abstraction between the actual filesystem and the tools you use to manipulate files. Otherwise all the tools should know about all the different filesystems or you needed a copy command per filesystem type. Since automation is about making life easier most of the tools talk to the kernel as if there is just a single filesystem: VFS (Virtual File System). The VFS then passes the requests on to the actual device driver (module).
As you can see from the above table a filesystem can be a local, like a harddisk, CD-ROM or USB-stick, but also network filesystems are handled through VFS. Linux also has some special filesystems like /proc, /sys.
Since everything within a UNIX™ system is a file, that means that files, special files and even directories are files. All these files are represented on the disk using inodes. To represent a disk (or partition) the VFS system uses Superblocks. More on this in the following sections.
The Superblock contains all the information about a certain filesystem (partition). It maintains all the details about the filesystem, like the block size, the total number of blocks available on the filesystem, the number of free blocks, the number of inodes on the filesystem, and the root inode of this filesystem.
The Superblock only handles metadata of mounted filesystems. It contains amongst others:
|device||The device this Superblock belongs to|
|blocksize||The blocksize of this filesystem|
|fstype||The filesystem type for this filesystem|
The first thing we need to describe is the dentry (directory entry) table, which describes which filename has which inode (index node). It is comparible to a DNS lookup table. It translates names to numbers (filenames to inode numbers).
The inode is a table with an unique number containing metadata that describes a file and it's access rights. An inode holds amongst other things:
|device||A device identifier of the device that the file is stored on|
|number||Contains the inode number|
|count||An inode can have several references to it (symlinks)|
|mode||The file mode, like 0750. So it indicates the file type and the access rights.|
|nlink||The number of hardlinks to this file|
|uid||The User ID(s) of the owner of this file|
|gid||The Group ID of this file|
|size||The size of the file|
|atime||The last access time|
|mtime||The last modification time|
|ctime||The last change time|