Linux file system
Linux file system – A partition’s or a disc drive’s structured collection of files is referred to as a Linux file system. A memory section known as a partition houses a particular set of data. Different memory divisions may exist in our computers. Typically, a file system is present on every partition.
To quickly retrieve files, the general-purpose computer system has to store data systematically. The data is stored on hard disks (HDDs) or a similar kind of storage.
Motives and Divisions for Preserving File System
Possible justifications for maintaining the file system include the following:
- The computer saves data most frequently in its RAM storage; if it is turned off, the data may be lost. When the power goes off, the data can still be saved because non-volatile RAM is still available in the form of Flash RAM and SSDs.
- Data storage on hard drives is chosen over RAM because disc space is less expensive. The cost of hard disks is steadily decreasing when compared to RAM.
The following divisions make up the Linux file system:
- (/) is the root directory.
- A particular data storage format (such as EXT3, EXT4, BTRFS, XFS, etc.).
- A logical disc or partition with a certain file system.
Linux File System Structure
Because the Linux file system consists of a root directory and its child directories, it has a hierarchical file structure. All additional directories are accessible from the root directory. There is usually only one system per department, although it may contain more information.
File systems are designed to protect and host data that does not change. The namespace is a name and organization mechanism that is essential for all information systems. A filename or subset of characters that can be used for the length of the filename is defined by the namespace. It also covers the process of organizing files in memory, including using folders to group related files together. After providing the namespace, the metadata description must be defined for certain data.
The hierarchical directory structure used to define the free space and disk space of a 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.
Software implementations
Information about the file system stored on disk is available at the file level and the structure it represents; separate and independent of information system metadata.
Two separate file system software implementations are included in the Linux file system.
Interact with the contents of the file system 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. Makes it easy for algorithms to tell how data is organized in the file system.
The Linux virtual file system refers to the first two data types provided. The kernel and programmers can use the instruction set to access system files. This virtual file needs some system drivers to provide an interface to the file system.
Directory Structure
We may store the files in the folders and find them when we need them. Additionally, directories are referred to as folders because, using the analogy of a physical desktop, one may 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 successively deeper names of the directory connected by the forward slash ‘/’, such as /var/spool/mail and /var/log, to access those directories. These are referred to as pathways.
Linux directories and their functions
The standard, well-known, and selected Linux directories are listed in the table below, along with a brief description of each one’s purpose:
- / (root filesystem): It is the root directory of the file system. Before inserting another disk, Linux should have all the files needed to boot the operating system. After the system starts, the root filesystem directories allow the mounting of every other filesystem on a known and accepted mount point.
- /boot: The static bootloader configuration, executable files, and kernel configuration needed to start a Linux computer are all contained there.
- /bin: There are executable files for users in this directory.
- /dev: It contains the device file for each piece of hardware attached to the system. These are not drives, but files that list every device in the system and allow access to it.
- /etc: There is a local config file on the host system.
- /lib: Included are shared library files needed to start the program.
- /home: User files can be stored in the home directory. Within /home, a subfolder exists for each user.
- /mnt: When an administrator is working on or fixing a filesystem, they can use it as an interim mount point for simple filesystems.
- /media: a place to attach external portable media devices, such USB thumb drives, that might be connected to the host.
- /opt: It contains extra files, such as vendor-supplied programs for applications, which must be included here.
- /root: Remember, it’s not the ‘/’ (root) file system; rather, it’s the default directory for a root user.
- /tmp: The OS and various programs store temporary files in this directory, which is transient. Users may also use this location to temporarily store files. Keep in mind that files in this directory may be deleted at any moment and without prior warning.
- /sbin: System binary files are these. They are system administration-related executables.
- /usr: They include executable libraries and binaries, man pages, and other documentation kinds. They are read-only and shared files.
- /var: Dynamic data files are stored here. It could include MySQL, log files, other database files, email inboxes, data files from the web server, and much more.
Features of the Linux File System
Linux’s file system creates a tree structure. All of the files are organized into a tree-like structure. The directory at the top is the root (/) directory. In Linux, every other directory is accessible from the root directory.
Here are a few essential characteristics of the Linux file system:
- Specifying paths: Linux substitutes the forward slash (/) for the backslash () when separating components. For instance, the data may be kept in C: My Documents Work on Windows, but it could be saved in /home/ My Document/ Work in Linux.
- Partition, Directories, and Drives: Unlike Windows, Linux does not use the driver to set the driver. Cannot differ from partitions, network devices, and “normal” directories and drives when using Linux.
- Case Sensitivity: Linux is case sensitive. Distinguishes lowercase filenames. For example, on Linux, test.txt and Test.txt are different from each other. Linux commands and folders are also subject to it.
- File Extensions: Files on Linux do not have file extensions, but files can end with “.txt”. For new shell users it can be difficult to separate files from directories. In a graphical file manager, icons are used to represent files and directories.
- Hidden files: The Linux operating system has traditional files and hidden files; config files are usually hidden. In most cases, we do not need to see or access confidential information. On Linux, hidden files are represented by a space (.) before the filename (for example, they are ignored). To access the file we need to run special commands in the shell or change the appearance of the file manager.
Linux file system types
Linux supports a variety of file systems when it is installed, including Ext, Ext2, Ext3, Ext4, JFS, ReiserFS, XFS, btrfs, and swap.
Let’s examine linux file system in more depth:
-
Ext, Ext2, Ext3 and Ext4 file system
Extended File System is the name of the file system. It was mostly made for MINIX OS. Ext is an old file system that is no longer in use due to a number of limitations.
Ext2 is the name of the first Linux file system to offer two terabytes of storage. Ext2 is used to develop Ext3, an enhanced version of Ext2 with backward compatibility. Ext3’s primary flaw is that servers cannot use it because it lacks disc snapshots and file recovery functionality.
The Ext4 file system is the fastest of the Ext file systems. It is the Linux distribution’s primary file system and is a particularly good substitute for SSD (solid-state drive) discs.
-
JFS File System
JFS, or Journaled File System, is a tool developed by IBM for AIX Unix. This is a replacement for the Ext file system. It can also be used as a substitute for Ext4 in circumstances where stability is required with constrained resources. This file system is useful when CPU power is limited.
-
ReiserFS File System
The Ext3 file system can be replaced with ReiserFS. It has more sophisticated features and better performance. Earlier, SUSE Linux utilized ReiserFS as its primary file system, but subsequently, after certain policy changes, SUSE switched back to Ext3. Despite supporting the file extension dynamically, there are certain performance issues with this file system.
-
XFS File System
It was thought that the XFS file system, which was developed for parallel I/O processing, was a fast variant of JFS. Even though NASA has a massive storage server (300+ Terabyte server), they still use this file system.
-
Btrfs File System
Btrfs is the abbreviation for the B tree file system. It is used for fault tolerance, thorough storage configuration, entertainment administration, and other things. It doesn’t work well with the manufacturing system.
-
Swap File System
The swap file system is used by the Linux operating system to page memory during system hibernation. The swap space need for a machine that never goes into hibernation is equal to the quantity of RAM.
What is mounting in the Linux File system?
A detachable disc or tape pack would physically need to be mounted on the proper drive device in the early days of computers, which is why the verb “to mount” is used in the Linux file system. The file system on the disc pack would be logically mounted by the OS after being physically located on the drive to make contents accessible to application applications, the OS, and users.
A directory generated as a component of a file is all that a mount point is. For instance, the /home directory houses the home file system. On many non-root file systems, file systems can be mounted on mount points, but this is less usual.
- Very early in the startup process, the Linux root file system is mounted on the / directory (root directory).
- Many files are then loaded from the Linux bootloader via systemd on the latest Linux distributions or rc on SystemV.
- The configuration file, /etc/fstab, manages file system mounting on startup.
- It is easy to understand that fstab stands for “file system table”; this is a list of filesystems that should be mounted with options and specific mount points that a particular filesystem should have.
The mount command can be used to mount file systems on a directory or mount point that is currently open. In other words, any directory used as a mount point must be empty and contain no other files. Linux does not prevent users from mounting file systems on existing files or directories that already contain files. The actual content will be concealed and just the contents of the newly mounted filesystem will be displayed if we mount a filesystem to an already-existing filesystem or directory.
Final Words
Fundamental elements of the operating system, the Linux file system, and the directory structure allow users to efficiently manage and organize their data while upholding system integrity and security.
Linux employs a hierarchical file system that is set up like a tree.
The root directory is the first directory in any Linux file system.
Depending on the use case, multiple file system types are available in Linux, and each kind has advantages and cons of its own.
Links
You can learn about linux more deeply by clicking the link below
Links
Learn about the linux commands by clicking the links below
https://linuxiron.com/echo-command-in-linux/
https://linuxiron.com/how-to-use-nice-renice-commands-in-linux/
https://linuxiron.com/how-to-use-kill-commands-in-linux/
https://linuxiron.com/a-beginners-guide-to-htop-for-process-management/
https://linuxiron.com/15-useful-yum-commands-in-linux/
https://linuxiron.com/how-to-use-the-top-command-in-linux/
https://linuxiron.com/17-ps-command-to-monitor-linux-process-with-examples-linuxiron/
https://linuxiron.com/12-cat-commands-in-linux-with-examples/
https://linuxiron.com/archiving-and-compressing-files-and-directories-in-linux/
https://linuxiron.com/how-to-run-the-du-command-in-linux/
https://linuxiron.com/how-to-backup-and-restore-the-linux-system/