CHAPTER 3. File System
Linux’s file system is outstanding when it comes to flexibility. Its design allows it to support regular, as well as special types of file formats. It can support text, programs, images, services, output, and input devices. Therefore, since it supports a variety of file formats, it can coexist with another OS.
Moreover, in the system, there is hardly a distinguishable factor between a file and a directory. It follows that directions are simply locations of file stacks.
Categorization of Files
To ensure a better understanding of the Linux file system, files are categorized. While it is considered safe to assume, knowing more information about a particular file allows programmers and system administrators to avoid complexities when using Linux. This also prevents them from performing long listings.
File categories:
The Art of Partitioning
Partitioning in Linux began when power failures threatened the majority of Linux users. There were days when an outage meant serious damages to a system.
Moreover, the primary reason for partitioning is to achieve a much higher data security level. The hard disk’s division allows safe grouping and protection.
Due to successful partitioning, you can prioritize data groups with more importance. When part of a hard disk is compromised, only that part of the disk is affected. The rest that is stored in other partitions remains untouched.
Two major partitions in a Linux system:
  1. Swap – refers to extra memory or an expansion
  2. Data – refers to normal data; refers to the necessities for starting and running  a system
Recommended partitions:
Common partitions:
Directories: The Root Directory & Subdirectories
In Linux, there is a directory called The Root Directory. It serves as the main directory and as programmers and system administrators would refer to it, it is the directory of all directories.
With The Root Directory come the subdirectories. These subdirectories manage files according to their assigned tasks.
Subdirectories and their content:
The Role of an Inode
In a Linux file system, an inode represents a file. An inode is a type of serial number that contains important information. Its primary role revolves around defining the number of files in a partition.
Throughout a Linux file system, especially one with multiple partitions, there are files with similar inode. To avoid complications, each partition is assigned its own inode.
Moreover, an assigned inode provides a description of a hard disk’s data structure. Once a hard disk’s initialization is finished, it can accept data storage during two points. One, data storage is acceptable during the installation process. Two, data storage is acceptable upon the addition of storage space to an existing system.
Information contained in an inode:
What Is The Superblock?
In Linux’s file system, the information about basic file size and shape is called The Superblock. It allows a file system manager to peruse and maintain a file system’s quality.
Information in The Superblock:
What Is a Group Descriptor?
A group descriptor is in charge of labeling a file’s data structure. It contains details to avoid duplication of data. Due to its role, a system’s possibility of corruption is minimal.
Information in a group descriptor:
File Modification: Finding, Mounting & Changing Sizes
A Linux file is usually easy to locate. Just search for a directory and the name that succeeds a “/” or a forward slash might be your preferred file.
Sample:
/home/lp.txt
As the sample shows, “/home/” is the directory and “lp.txt” is a file.
You can then start mounting. When mounting a file, the availability of a Linux kernel is necessary to check the standards. Its presence allows the validation of all of a system’s passed arguments.
Sample:
# mount
iso898 /dev/rom /dev/cdrom
As the sample shows, you are mounting three kinds of information. “iso898”, “/dev/rom”, and “/dev/cdrom”.
Apart from finding and mounting a file, you have the option to change a file’s size. This is done due to the occurrence of a file’s fragmentation.
Since files become inefficient during fragmentation, changing a file’s size allows the allocation of files. Consequently, the system becomes more stable.
You are introduced to the commands “truncate” and “fallocate”. Both commands allow you to create a file with a preferred size.
Sample:
# truncate -s 19MB mop1.txt
# fallocate -l 19000000 mop2.txt
# ls -ls mop.txt
0 -rw-rw--r-- 2 trs trs 19000000 Aug 12 02:44 mop1.txt
14819 -rw-rw--r-- 2 trs trs 19000000 Aug 12 02:45 mop2.txt
As the sample shows, you created a “19MB” file called “mop” on “Aug 12”.