Ubuntu

How to Manage Linux File System on Ubuntu Server

How to Manage Linux File System on Ubuntu Server

Introduction

One must understand how the Linux file system works. Many newbies struggle in managing their Linux servers. They often get into trouble because they don’t know how to change defaults or improve the performance of their system. Fine-tuning your server 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. In this guide, I am using Ubuntu 20.04. All the instructions and commands are valid for any related Linux server which uses the apt packaging system.

Understanding Linux File System

First, we will try 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

This clearly shows us that the root file system is using the ext4 file system on our Ubuntu machine. It has a name as sda2 which can be changed. For now, we are not messing up with the disk names.

Tuning File System

Now we have figured out which file system we are using. It is time that we should learn how to tune it. 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

As you can see it has thrown us some good enough data after tuning up. We can see detailed information when it was last mounted or a user last wrote into the disk.

Check Attributes Of Logical Volumes

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

As you can see we have plenty of information regarding our logical volumes. In our case, we have only one on our server.

If you ever need to create new logical volumes, you must use lvdisplay to learn how to proceed instead of breaking your system.

Check Disk Stats For Optimal Performance

If I 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.

Conclusion

In this article, we figured out how to keep check and balance of our file system. This article can never encompass full file system management. We will keep publishing advanced articles to make the best use of your Linux resources on both desktop and servers. For not this is all. If you have any questions, just hit in the comments then.

Similar Posts