Wed Sep 21 2022
Linux file system
A file system is a collection of files on a partition or disk. Your hard drive can have various partitions which usually contain only one file system, such as one file system housing/file system or another containing/home file system. One file system per partition allows for the logical maintenance and management of differing file systems.
In Linux, you can choose whether you want to manage files and folders with a file manager or if you rather like to use the command line which is the traditional way. A file manager provides a graphical and more intuitive way to handle these tasks. Files are systematically organized in directories. Linux starts file system with root directory(/). All files and directories are created and managed under the root directory. Since root directory stands on the top of the file system, it has no parent directory. Besides root directory, every directory in Linux has a parent directory. Linux allows us to create as many files and directories as we want. We can create files under the existing directories or may create new directories.
Types of Linux File Systems
A standard Linux Distribution provides the choice of partitioning disk with the file formats listed below, each of which has special meaning associated with it.
ext2, ext3, ext4
These are the progressive version of Extended Filesystem (ext), which primarily was developed for MINIX. The second extended version (ext2) was an improved version. Ext3 added performance improvement. Ext4 was a performance improvement besides additional providing additional features.
The Journaled File System (JFS) was developed by IBM for AIX UNIX which was used as an alternative to system ext. JFS is an alternative to ext4 currently and is used where stability is required with the use of very few resources. When CPU power is limited JFS comes in handy.
It was introduced as an alternative to ext3 with improved performance and advanced features. There was a time when SuSE Linux default file format was ReiserFS but later Reiser went out of business and SuSe had no option other than to return back to ext3. ReiserFS supports file System Extension dynamically which was relatively an advanced feature but the file system lacked certain area of performance.
XFS was a high-speed JFS which aimed at parallel I/O processing. NASA still usages this file system on their 300+ terabyte storage server.
B-Tree File System (Btrfs) focus on fault tolerance, fun administration, repair System, large storage configuration and is still under development. Btrfs is not recommended for Production System.
System directories contain files, software, applications and scripts which are required to run and maintain the Linux. System directories are automatically created during the installation.
/ - The first directory in Linux File System. It is also known as root directory or main directory. All files and directories are created and managed under this directory.
/home - Default directory for user data. Whenever we add a new user, Linux automatically creates a home directory matching with his username in this directory. Whenever user login, Linux starts his login session from home directory.
/root - This is the home directory for the root user. The root user is the superuser in Linux. For security reason, Linux creates a separate home directory for the root user. Root user account is also being created during the installation automatically.
/bin - This directory contains standard commands files. Commands stored in this directory are available for all users and usually do not require any special permission to run.
/sbin - This directory contains system administration commands files. Commands stored in this directory are available only for root user and usually requires special privilege to run.
/usr - This directory contains user application software files, third-party software, and scripts, document files and libraries for programming languages.
/var - This directory stores variable data files such as printing jobs, mailbox etc.
/etc - This directory contains system configuration files.
/boot - This directory contains Linux boot loader file.
/mnt - This directory is used to mount the remote file system and temporary devices such as CD, DVD, and USB.
/dev - This directory contains device files. Usually, files in this directory are dynamically generated and should be never edited.
/tmp - This directory provides a temporary location for applications.
Features of the Linux file system
As opposed to Windows, Linux does not use backslashes to separate the components of a pathname, it uses slashes instead. The private data of users in Windows may be stored under C:\My Documents\Letters, whereas in Linux it would be stored under /home/username/Letters.
Partitions, Drives/Devices, and Directories
Linux does not use drive letters as Windows does. From the mere appearance of a pathname in Linux you can not tell whether you are addressing a partition, a drive/device, a network device or an “ordinary” directory.
Mounting and Unmounting
In Linux however, partitions or devices are usually not visible in the directory tree unless they are mounted, that means integrated into the file system at a specific location in the directory tree. As a normal user, you cannot access data on a partition or a device unless it is mounted. But, most of the times you do not have to mount partitions or devices manually. During the installation of your system, you can define partitions to be mounted automatically when the system is started. Removable devices are usually also detected and mounted automatically by your system - the desktop environments such as KDE or GNOME will inform you about the appearance of a new device. Although this concept of mounting and unmounting may appear complicated or cumbersome at first sight this also offers great flexibility. For example - you can easily mount a directory from another machine over the network and act on that directory as though it were located on your local machine.
Linux distinguishes between uppercase and lowercase letters in the file system. For example, whether you name a file test.txt, TeST.txt or Test.txt make a difference in Linux. This also holds true for directories: You cannot access a directory named Letters by the name letters.
Files in Linux may have a file extension, such as .txt, but do not need to have one. When you start working with the shell this sometimes makes it difficult for beginners to differentiate between files and folders, depending on the command you use to list the contents of a directory. If you use the graphical file managers in KDE or GNOME, see GNOME User Guide and KDE User Guide, files and folders are symbolized by various different icons depending on the view you choose.
Linux also distinguishes between “normal” files and hidden files which are often configuration files that you usually do not want to access or see as a normal user. In Linux, hidden files are indicated by a dot in front, for example - .hidden file. In order to access hidden files, you can switch view in the file managers as described in Section “Managing Folders and Files with Konqueror” (Getting Started with the KDE Desktop, ↑KDE User Guide) or use a certain command in the shell.
File System Permissions
Because Linux is a multiuser system, every file in a Linux file system belongs to a user and a group. Only the owner of a file or directory (or root) can grant other users access permission to it. Linux basically distinguishes between three different types of access permissions such as - write permission, read permission and execute permission. You can only access a file or a folder if you have at least read permission to it. There are several ways to change the access permissions of files and folders - either traditionally via the shell or with the help of your desktop's file manager ( Getting Started with the KDE Desktop, ↑KDE User Guide). If you have root privileges, you can also change the owner and the group of a file or folder.
Here in this article, we tried to throwing lights on File System Management as well as disk management in much more depth. Hope you like this article. You can share your comments in the below. Thank you!