So far, so good, I believe everyone understands the file system hierarchy in Linux. So I’m going to be explicit in my explanation bearing in mind that my readers already have basic concepts on the hierarchical structure of the Linux file system.
First, let’s understand what file system means. A File system is an organized structure of storing data such as files and directories which reside in a device such as the physical device or the partition device. In Linux, a file system can be extended by adding a new device in the already existing file system in the file system hierarchy. Unlike the Windows operating system, a newly added file system is represented by a separate drive letter. A file system can be mounted on an existing directory tree (which is called the mount point) to add to the existing file system. For example, in Windows, if I plug in my flash drive, which has a file system recognized by Windows, the system automatically mounts it on a separate drive, but in Linux, mounted devices are not represented on a different drive but instead mounted on the existing file system hierarchy. Don’t worry; I could be getting you confused with all these terminologies; you will understand better when I present you with a diagram distinguishing differences in both operating systems when devices are mounted.
This article will help you understand the different supported file systems in Linux and as well as the various methods to determine your file systems in Linux.
UNDERSTANDING THE LINUX FILE SYSTEM
You should know that a file system enables you to retrieve and write to a hard drive, flash, or optical drive. Without a file system on those drives, data in it is worth useless because you won’t have access to view inside the disk drives. A typical example is in Windows. You must have seen a partitioned drive in Windows, which has no volume indicator to display the used and unused drive size. Such a disk drive or flash drive has no file system, and once you tried clicking to open it, the system will prompt you to format the drive before it can be used. What the system is trying to tell you is to format the drive so that it will be able to assign a file system to it before it can be used. By default, Windows will assign the NTFS file system to it. Please don’t bother yourself about the types of file systems; it will be discussed in the subsequent topic.
Let me present the Windows and Linux view of what I’m trying to explain for clarity sack
The above is the Windows view of a disk drive using the NTFS file system. In a disk drive with no file system, the size indicator, as seen above, won’t be displayed, and an attempt to try opening the disk drive the system will prompt you to format the disk drive, which invariably means to assign a file system to the disk. In the same image, you can also see that each file system is mounted separately as partitions. This is not the case in Linux. Let’s take a look at how Linux manages its file systems
This is equivalent to what was displayed in the Windows environment. Linux assembles all file systems into a single directory tree with a single root, the / directory. The advantage here is that the existing hierarchy can be extended by adding a new disk with the same file system.
It is also important to know that the concept of partition exists in every operating system and these partitions is a way of compartmentalizing your disk so that different partition can be used for a different purpose. Each partition can be formatted with any file system to perform a unique function on its own.
TYPES OF FILE SYSTEMS IN LINUX
There are various file systems supported by various operating systems such as MAC OX, Linux, Unix, and Windows. Most of these file systems are supported by multiple Operating systems why some operating systems do not recognize some file systems
There is always a reason for the different support of file systems, the choices of file system come from the various ways in which they organize their data. Some file systems have higher security features when compared to others. Some support drives with higher storage capacity, while others don’t. Some are more robust and resistant to file corruption, while others tend to offer a higher speed but not robust.
No developer will say a file system is better than the other. Every operating system be it Linux, Windows, Unix, Mac OX have their file system which supports how files are organized, retrieved, indexed and how metadata are associated with them
We will be looking at some standard file systems available and those supported by Linux. Please note that this is not a comprehensive view of all available file system types
FAT: The FAT file system stands for File Allocation Table. Microsoft Windows systems support the FAT file system to locate files on disk. It provides quick access to files depending on the partition size, file size, file type, fragmentation, and the number of files in a folder. The new version of this file system is FAT32. The FAT32 file system supports larger disk from 512-2TB and as well a better storage efficiency. It is also supported by a variety of Operating systems other than Windows
NTFS: The NTFS stands for New Technology File System. It is the default file system for Windows operating systems for their disk partitioning. It offers more security than the FAT file system. This security is maintained by assigning NTFS file permissions to files and folders. By default, Linux doesn’t support NTFS, but drives of such file system can be accessed through an open-source package called NTFS-3G
EXT2/EXT3/EXT4: The EXT’s is a file system supported by Linux, the ext2 is an older version of ext3. It lacks an important feature like journaling, and it cannot handle corruption, and it’s not robust. For so reason, they introduced the ext3, which is an improved version of ext2 with added speed. Finally, they introduced the ext4, which offers more features compared to the ext2 and ext3. Most Linux distribution uses this file system, and it is not supported by Windows or Mac except with a unique tool.
SWAP: In Linux, a swap is not really a file system, but a partition formatted as swap is reserved for system memory
UDF: This stands for Universal Disk Format. It is used for mounting disc drives or generally ISO files. It replaces the commonly used ISO9660 file system
NFS: The NFS stands for Network File System. It allows the sharing of files over networks. It allows users to access files remotely. Unlike other file systems, the NFS is not specific to a particular operating system. It allows systems of different architecture to share files across networks.
XFS: The XFS Stands for the Extended File System. The xfs is a high-performance file system used for journaling. It is a default file system for RedHat Linux. It supports a maximum of 500TB file systems and 16TB file size. The xfs file system can be created on the system partition or the logical volume. We will be looking at how this is done in subsequent articles.
HOW TO EXAMINE FILE SYSTEMS IN LINUX
There are various ways to get the file system types available in your Linux systems. Here we will be looking at some commands needed to get an overview of your file system.
The first is the df command. The df command gives an overview of the file system and the available free space in the system. There are options you can specify alongside with the df command. We will also be looking at a few of the options
The df command without any option specified will display the mounted file system, total disk space, the available disk space, and the used disk space. The output is entirely not in a human-readable format.
As you can see, you cant tell the amount of disk space on the system. To improve readability, you run the df –h or df –H command. The first option (-h) will output disk size in KB, MB, or GB, e.g., 20KB, 80MB 2G. The second will use the power of 1000 to display its size
You can also use the du command to display more detailed information about space used by the directory tree in your system. You can as well specify the –h and –H option as used in dh command to get a human-readable output
These are the sizes of all directory tree in the /var/log directory. You can run the du –h command to make the output more readable
To get the type of file system used, you run the df or du command with the –T option
The column that shows “Type” displays the file system type of the mounted devices in the system. The same applies to the du command.
You can as well use the parted command to get the same information and as well the lsblk (list block ID) or the blkid for the same output
I will only be giving you an example on the lsblk command with the –f option. You can as well practice others at a convenient time. It still follows the same procedure. All other options to use can be found in the manual page of the command. If you are finding it difficult to know the option which displays a file system, you can look up the manual page of the command to see your options
CONCLUSION
I guess you understand file systems. It not just for your knowledge in Linux but in all other operating systems. File systems are available in all operating systems, but you as a user will have to know what file system your operating system supports. It helps you understand how to format your drive, especially those working in the Windows Operating systems. You must have tried plugging your hard drive on a Mac machine, and you found out that the system was unable to read the drive, that’s because the Mac OS does not support the file system used in formatting the drive.
Please look up to your manual page of any command you are finding difficult to use, or you can drop a message in the comment section if you get confused about any part in this article. In the next article, we will be discussing how to mount these file systems on our Linux machine