Knowing how the Linux file system works will not only help you to improve the overall efficiency of the system but also the number of requests to your applications, databases, and static files will improve dramatically. An efficient file system is essential for everyday system processes.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux System files queries.
In this context, we shall look into How to Manage Linux File System on Ubuntu Server.
The first thing to do is to know what kind of file system do we have on the system. To figure out that, we will write the following command:
$ cat /etc/fstab
In our case, the root file system is using the ext4 file system. It has a name as sda2 which can be changed.
A Tuned file system helps us to remove bad blocks in our disk and improve stability and speed.
Let's enter the following command on CLI and find out if it works:
$ sudo tune2fs -l /dev/sda2
Checking attributes of logical volumes help us to determine if a particular volume can be used for external logging or not. It helps with database systems where we keep errors and logs on a separate volume.
Let us run the command and understand the logical volumes of the ext4 file system. You need to be either rooted or use sudo to get access to logical volumes:
$ sudo lvdisplay
If you ever need to create new logical volumes, you must use lvdisplay to learn how to proceed instead of breaking your system.
If we tell you that you can learn what is your disk's true stats are then you will probably jump out of your comfort zone. But, it is true. You can see the raw stats of your system.
If you do not have iostat package installed yet then it is time that you should install it:
$ sudo apt install iostat
Once installed simply run:
$ iostat -x
It will show you request size as avgrq-sz which shows how your disk is performing against requests.
If your disk's avgrq-sz is higher than 100.0 then it means it is performing optimally. Otherwise, you will need to improve it.
This article covers how to keep check and balance on your file system. Ext4 is the default file system on most Linux distributions for a reason. It's an improved version of the older Ext3 file system. It's not the most cutting-edge file system, but that's good: It means Ext4 is rock-solid and stable.
If you're setting up partitions on your main Linux boot drive, you'll also want to create a swap partition of at least a few GBs in size when setting up those partitions. This partition is used for "swap space". It's similar to the paging file on Windows. Linux swaps out memory to the swap space when its RAM is full. This partition must be formatted as "swap" instead of with a particular file system.