File Systems: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
m (→‎Expert filesystems: Added link to apple NTFS)
(→‎File System Theory: General concepts of filesystem operation and organization)
Line 9: Line 9:
{{In Progress}}
{{In Progress}}


A filesystem provides a generalized structure over persistent storage, allowing the low-level structure of the devices (e.g., disk, tape, flash memory storage) to be abstracted away. Generally speaking, the goal of a filesystem is allow logical groups of data to be organized into ''files'', which can be manipulated as a unit. In order to do this, the filesystem must provide some sort of index of the locations of files in the actual secondary storage. The fundamental operations of any filesystem are:
=== Inodes ===

* Tracking the available storage space
* Tracking which block or blocks of data belong to which files
* Creating new files
* Reading data from existing files into memory
* Updating the data in the files
* Deleting existing files

(Perceptive readers will note that the last four operations - Create, Read, Update, and Delete, or CRUD - are also applicable to many other data structures, and are fundamental to databases as well as filesystems.)

Additionally, there are other features which go along with a practical filesystem:

* Assigning human-readable names to files, and renaming files after creation
* Allowing files to be divided among non-contiguous blocks in storage, and tracking the parts of files even when they are ''fragmented'' across the medium
* Providing some form of hierarchical structure, allowing the files to be divided into ''directories'' or ''folders''
* Buffering reading and writing to reduce the number of actual operation on the physical medium
* Caching frequently accessed files or parts of files to speed up access
* Allowing files to be marked as 'read-only' to prevent unintentional corruption of critical data
* Providing a mechanism for preventing unauthorized access to a user's files

Additional features may be found on some filesystems as well, such as automatic encryption, or journalling of read/write activity.

=== Indexing Methods ===
There are several methods of indexing the contents of files, with the most commonly used being ''i-nodes'' and ''File Allocation Tables''.

==== Inodes ====
Inodes (information nodes) are a crucial design element in most Unix filesystems: Each file is made of data blocks (the sectors that contains your raw data bits), index blocks (containing pointers to data blocks so that you know which sector is the nth in the sequence), and one inode block.
Inodes (information nodes) are a crucial design element in most Unix filesystems: Each file is made of data blocks (the sectors that contains your raw data bits), index blocks (containing pointers to data blocks so that you know which sector is the nth in the sequence), and one inode block.


The inode is the root of the index blocks, and can also be the sole index block if the file is small enough. Moreover, as unix filesystems support hard links (the same file may appear several times in the directory tree), inodes are a natural place to store metadata such as file size, owner, creation/access/modification times, locks, etc.
The inode is the root of the index blocks, and can also be the sole index block if the file is small enough. Moreover, as unix filesystems support hard links (the same file may appear several times in the directory tree), inodes are a natural place to store metadata such as file size, owner, creation/access/modification times, locks, etc.

==== FAT ====
The File Allocation Table ([[FAT]]) is the primary indexing mechanism for MS-DOS and it's descendants. There are several variants on FAT, but the general design is to have a table (actually a pair of tables, one serving as a backup for the first in case it is corrupted) which holds a list of blocks of a given size, which map to the whole capacity of the disk.


== Workings of File Systems ==
== Workings of File Systems ==