An organized group of files on a disc drive or partition is known as a Linux file system. A partition is a section of memory that holds a particular set of data. Different memory partitions are possible in our machine. A file system is typically present on every partition.
So that we can quickly access the files, the general-purpose computer system must store data in a methodical manner. The data is kept on hard discs (HDD) or an analogous sort of storage. Below are some possible justifications for retaining the file system:
o The computer saves data mostly to its RAM storage; if it is shut off, the data may be lost. Non-volatile RAM, such as Flash RAM and SSD, is available, nevertheless, so the data can still be kept after the power is cut.
o Hard drives are favored for data storage over conventional RAM since disc space is less expensive. Compared to RAM, the cost of hard discs is gradually declining.
A root directory (/)
A particular data storage format (such as EXT3, EXT4, BTRFS, XFS, etc.)
A logical volume or partition with a certain file system.
A Linux operating system’s built-in layer known as the file system is typically utilized to manage the storage’s data. Arranging the file on the disc storage is helpful. It controls a file’s name, size, creation date, and a great deal more information.
If our file system contains a file format that is not supported, we can download software to handle it.
Due to the existence of a root directory and its subdirectories, the Linux file system features a hierarchical file structure. From the root directory, you can access all other directories. Though it is uncommon, a partition could have more than one file system.
A file system is made to be able to control and accommodate non-volatile storage data. A namespace, which is a naming and organizational mechanism, was necessary for all file systems. A subset of characters that can be used for the file name or the length of the file name are both defined by the namespace. Additionally, it describes the logical organization of files on a memory segment, such as the use of folders to group particular files together. A Metadata description for that specific file must be defined after a namespace has been described.
The hierarchical directory structure, which is used to describe the free and occupied disc space for a certain block, must be supported by the data structure. Additionally, it contains information about the files’ size, latest modification date, and creation date and time.
Additionally, it keeps detailed information on the disc region, including volumes and partitions.
The information about the file system saved on the drive is contained in the advanced data and the structures that it represents; it is separate and unrelated from the file system metadata.
A two-part file system software implementation architecture is present in the Linux file system. Think about the photo below:
To interact with the file system’s elements, such as files and directories, you need to access the function calls through an API (application programming interface). The use of API makes operations like copying, deleting, and creating files easier. It makes it easier for an algorithm to specify how files should be organized on a file system.
A Linux virtual file system is what is referred to as the first two components of the supplied file system. The file system can be accessed by the kernel and programmers using a single set of commands. To provide an interface to the file system, this virtual file system needs a certain system driver.
We can store the files in the directories and find them when we need them. Additionally, directories are referred to as folders because, using the analogy of a physical desktop, one can conclude that they are folders where files are stored. Linux and a few other operating systems allow for the hierarchy of directories to be organized in a tree-like fashion.
The Linux FHS (Filesystem Hierarchy Standard) contains detailed documentation and definitions of the directory structure. Using the sequentially deeper names of the directory linked by the forward slash ‘/’, such as /var/spool/mail and /var/log, to access those directories. These are referred to as pathways.
The following table provides a very brief summary of standard, well-known, and defined top-level Linux directories and their functions:
/ (root filesystem): It is the root directory of the filesystem. Before mounting another filesystem, it must include all of the files required to boot the Linux operating system. Each other
The root filesystem directories are used to mount the filesystem on a predetermined and common mount point once the system has booted.
/home: User files can be stored in the home directory. Within /home, a subdirectory exists for each user.
/root: It serves as the root user’s home directory. Not the ‘/’ (root) file system, keep that in mind.
/etc: It contains the host system’s local system configuration files.
/boot: It contains the static bootloader configuration, executable files, and kernel configuration required to boot a Linux computer.
/dev: It contains the device file for each piece of hardware attached to the system. Instead of being device drivers, these are files that list every device on the system and grant access to it.
/bin: There are executable files for users in this directory.
/sbin: System binary files are these. They are system administration-related executables.
/lib: Shared library files that are required to launch the system are included.
/media: a location to mount external removable media devices, such as USB thumb drives, which might be connected to the host.
/mnt: When an administrator is working on or fixing a filesystem, they can use it as a temporary mount point for simple filesystems.
/opt: It contains extra files, such as vendor-supplied programs for applications, which must be inserted here.
/var: Files with variable data are kept here. MySQL, log files, other database files, email inboxes, web server data files, and many other things may be there.
/usr: Including executable libraries and binaries, man files, and various documentation kinds, they are read-only and shareable files.
/tmp: The OS and various programs store temporary files in this directory, which is transient. Users may also utilize this location to temporarily store files. Keep in mind that files in this directory may be deleted at any time and without prior notice.
The file system in Linux builds a tree structure. All of the files are set up in the shape of a tree with branches. The root (/) directory is the one at the top. The root directory in Linux provides access to every other directory.
Here are a few essential characteristics of the Linux file system:
Specifying paths: When specifying paths, Linux utilizes the forward slash (/) rather than the backslash () to divide the components. For instance, the data might be kept in C: My Documents Work on Windows, whereas it would be stored in /home/ My Document/ Work in Linux.
Partition, Directories, and Drives: In contrast to Windows, Linux does not organize drives using drive letters. When using Linux, it is impossible to distinguish between a partition, a network device, and a “ordinary” directory and drive.
Case Sensitivity: Linux has a case-sensitive file system. It makes a distinction between file names in lowercase and uppercase. For instance, in Linux, test.txt and Test.txt differ from one another. Also subject to this regulation are Linux commands and folders.
File Extensions: There is no requirement for a file to have a file extension on Linux, yet it is possible for a file to end in “.txt.” It can be challenging for new users learning Shell to distinguish between files and directories. When using a graphical file manager, the files and folders are represented by icons.
Hidden files: Linux has a distinction between regular files and hidden files; in the Linux operating system, configuration files are often hidden. Most of the time, we don’t need to read or access the hidden files. In Linux, hidden files are indicated by a dot (.) before the file name (for example,.ignore). We need to run a special command in the shell or alter the file manager’s view in order to access the files.
Linux offers a variety of file systems when it is installed, including Ext, Ext2, Ext3, Ext4, JFS, ReiserFS, XFS, btrfs, and swap.
Let’s examine each of these file systems in more depth:
The file system is known by the term Extended File System. It was primarily made for the MINIX OS. Ext is an old file system that is no longer used due to a number of limitations.
Ext2 enables managing two terabytes of data and is the first Linux file system to do so. Ext3, an improved version of Ext2 with backward compatibility, is created through Ext2. Ext3’s primary flaw is that servers cannot use it because file recovery and disc snapshots are not supported by this file system.
Ext4 Among all the Ext file systems, the file system is the fastest. It is the default file system in the Linux distribution and is a particularly compatible alternative for SSD (solid-state drive) discs.
2. File System JFS
Journaled File System, or JFS for short, is a program created by IBM for AIX Unix. A replacement for the Ext file system is this one. In situations when stability is required with limited resources, it can also be used in place of Ext4. When CPU power is constrained, this file system comes in handy.
The Ext3 file system has competition in the form of ReiserFS. It performs better and has more sophisticated features. SUSE Linux previously utilized ReiserFS as its default file system, but subsequently, it altered several restrictions and SUSE switched back to Ext3. Although this file system dynamically supports the file extension, there are certain performance issues.
The XFS file system, which was created for parallel I/O processing, was seen as a high-speed version of JFS. Despite having a huge storage server (300+ Terabyte server), NASA continues to use this file system.
The B tree file system is referred to as Btrfs. It is utilized for fault tolerance, extensive storage configuration, fun administration, and more. It does not fit the production system well.
During system hibernation, the Linux operating system pages memory using the swap file system. A system that never enters the hibernation state must have swap space that is equivalent to the size of its RAM.
The term “to mount” in the Linux filesystem refers to the early days of computing when a detachable disc or tape pack would physically need to be mounted on the appropriate drive device. After being physically located on the drive, the filesystem on the disc pack would be logically mounted by the OS to make contents accessible to application programs, the OS, and users.
A mount point is just a directory created as a part of the filesystem. For instance, the /home directory houses the home filesystem. On many non-root filesystems, filesystems can be mounted on mount points, but this is less usual.
The mount command can be used to mount filesystems on a directory or mount point that is currently open. In other words, every directory that is used as a mount point should be empty and without any other files. Linux won’t stop users from mounting a filesystem on an already-existing one or on a directory that already has files on it. If we mount any filesystem on any existing filesystem or directory, the actual contents will be hidden and just the recently mounted filesystem content would be shown.