Filesystems are the way to organize, structure and access files, directories, and links to your hard drive. How to organize, access and recognize the particularities of each file system falls under the Kernel. It has to “provide support” for that file system.
Currently Linux kernel recognizes most existing file systems: fat16, fat32, ntfs, ext2, ext3, reiserFS, nfs, smb, iso9660 etc.
Many times in the study of Unix/Linux operating systems we find the phrase – “everything is a file”. This refers to the fact that each program, or positive hardware device, is represented by a file. There is no other way to represent the information. In Linux files are case sensitive – a distinction is made between the big letter and the small letter. Over time, standardization of the file system for Unix/Linux systems has been attempted, resulting in the FHS – Filesystem Hierarchy Standard. The Linux file system is arborescent and unique.
The root is called root and is marked with “/”.
A file system can be divided into four distinct parts in the following order:
1. Boot Block – at the beginning of the partition and containing code (bootloader) to load the operating system.
2. Super Block – contains current file system information: its size, no. free data blocks, their location, the size of inode tables, the maximum number of inodes, etc.
3. Inode Table (List) – The static list initially defined at installation and that can not be changed and which contains the inks in the system.
4. Data Blocks – Data is saved in blocks (generally 1 block = 512 bytes).
A file consists of the information it contains (text, data, image, sound, etc.) but also a data structure called inode (index node) and including additional information about that file.
The POSIX standard establishes that each inode contains the following information:
a. File type
c. group owner
d. Access rights (reading, writing, execution) for the owner, group, and others
e. of hard links to the same information
i. the size of a file
j. pointer to the data blocks that represent the information held by the file.
k. inum – nr. the whole that uniquely identifies each inode
In Linux, files are divided into the following categories:
1. regular files. These can be text, executable, binary, etc
2. directories. These are all files that have the role of container for other files or directories. They represent a special type of file (container) used to form the tree structure.
3. links. They can be soft links/symlinks (the equivalents of windows shortcuts) and hard links – refer to the same data area, but identified by different names.
4. special files (device files). A file represents all physical devices (hard disk, RAM, etc.). Access to these devices is accomplished by writing/reading from these files.
There are several kinds of special files (devices):
a. character type – used to access a byte of the file representing the hardware device.
b. block type – used to access the data block of the hardware file.
c. named pipes – Linux processes communicate with a pipe that is created by the “|” character. In this way, the output of a process can be directed as input for another process. This type of pipe exists only during commands execution. There is a second pipe named pipe, originally introduced in the AT & T Unix, and used to communicate processes through a FIFO (First In First Out) queue. This type of file is created by the system administrator to interconnect 2 processes with the mkfifo command.
d. The socket (UNIX domain socket) is similar to the pipe, that is, it is used to connect two processes. There is some resemblance to the TCP/IP socket even if it’s another concept.