Table of Contents
Now it is the time to understand Linux from the inside, and we will start with the Linux file system.
If we want to talk about Linux File System, we need to talk about it from the lower level and the top level in order to fully understand it.
You can check this link for a general overview File System
What Is Linux File System?
Linux File System or any other file system is the layer which is under the operating system that handles the positioning of your data on the storage, without it; the system cannot knows which file starts from where and ends where.
We are talking about Linux, which supports many file system types. You can even download a software that can handle a new file system when it arises and deal with it. So what are Linux file system types?
Linux File System Types
When you try to install Linux you will see that Linux offers many file systems like these:
Ext, Ext2, Ext3, Ext4, JFS, XFS, btrfs and swap
So what are these file systems that Linux offers?
Ext: old one and no longer used due to limitations.
Ext2: first Linux file system that allows 2 terabytes of data allowed.
Ext3: came from Ext2, but with upgrades. It keeps the backward compatibility and you can upgrade your Ext2 to Ext3 without problems.
The only problem about it that the servers don’t use this kind of file system because this file system doesn’t support file recovery or disk snapshots.
Ext4: faster and allow large files with significant speed.
It is a very good option for SSD disks and you notice when you try to install any Linux distro that this one is the default file system that Linux suggests.
JFS: old file system made by IBM. It has a Good performance for both large and small files and because of its low CPU usage but failed and files corrupted after long time use, reports say.
XFS: old file system and works slowly with small files.
Btrfs: made by oracle. It is not stable as Ext in some distros, but you can say that it is a replacement for it if you have to. It has a good performance.
You may notice From the comparison above that Ext4 is the best Linux File System
Top Level Explanation
Now you know what file system Linux is and its types. So what is inside that filesystem, I mean from the top level.
You may come from Windows, and Windows has partitions like C:\ and D:\, you can install Windows on any of these partitions, usually C:\.
What about Linux File System Hierarchy? Well, it has a different structure than Windows.
If you navigate to the root partition which is / you’ll see the structure of the Linux File System.
Most distros have the same structure with some little difference between distros.
Linux File System Directories
/bin: Where Linux core commands reside like ls, mv.
/boot: Where boot loader and boot files are located.
/dev: Where all physical drives are mounted like USBs DVDs.
/etc: Contains configurations for the installed packages.
/home: Where every user will have a personal folder to put his folders with his name like /home/likegeeks.
/lib: Where the libraries of the installed packages located since libraries shared among all packages
unlike windows, you may find duplicates in different folders.
/media: Here is the external devices like DVDs and USB sticks are mounted and you can access their files from here.
/mnt: Where you mount other things Network locations and some distros you may find your mounted USB or DVD.
/opt: Some optional packages are located here and this is managed by the package manager.
/proc: Because everything on Linux is a file, this folder for processes running on the system,
and you can access them and see much info about the current processes.
/root: The home folder for the user root.
/sbin: Like /bin, but binaries here are for root user only.
/tmp: Contains the temporary files.
/usr: Where the utilities and files shared between users on Linux.
/var: Where variable data is located, like system logs.
Now you have a good idea about what the Linux file system is.
Different file system lead to different performance so it is very important to know the file system.