{"id":9342,"date":"2021-08-17T13:09:52","date_gmt":"2021-08-17T13:09:52","guid":{"rendered":"https:\/\/linuxways.net\/?p=9342"},"modified":"2021-08-17T13:09:52","modified_gmt":"2021-08-17T13:09:52","slug":"how-to-manage-linux-file-system-on-ubuntu-server","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-manage-linux-file-system-on-ubuntu-server\/","title":{"rendered":"How to Manage Linux File System on Ubuntu Server"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>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\u2019t 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.<\/p>\n<h2>Understanding Linux File System<\/h2>\n<p>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:<\/p>\n<pre><strong>$ cat \/etc\/fstab<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"795\" height=\"244\" class=\"wp-image-9343\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-316.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-316.png 795w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-316-300x92.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-316-768x236.png 768w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/p>\n<p>This clearly shows us that the root file system is using the <strong>ext4<\/strong> file system on our Ubuntu machine. It has a name as <strong>sda2<\/strong> which can be changed. For now, we are not messing up with the disk names.<\/p>\n<h2>Tuning File System<\/h2>\n<p>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.<\/p>\n<p>Let\u2019s enter the following command on CLI and find out if it works:<\/p>\n<pre><strong>$ sudo tune2fs -l \/dev\/sda2<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"502\" height=\"594\" class=\"wp-image-9344\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-317.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-317.png 502w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-317-254x300.png 254w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\" \/><\/p>\n<p>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.<\/p>\n<h2>Check Attributes Of Logical Volumes<\/h2>\n<p>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.<\/p>\n<p>Let us run the command and understand the logical volumes of the <strong>ext4<\/strong> file system. You need to be either rooted or use <strong>sudo<\/strong> to get access to logical volumes.<\/p>\n<pre><strong>$ sudo lvdisplay<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"523\" height=\"313\" class=\"wp-image-9345\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-318.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-318.png 523w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-318-300x180.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-318-501x300.png 501w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/p>\n<p>As you can see we have plenty of information regarding our logical volumes. In our case, we have only one on our server.<\/p>\n<p>If you ever need to create new logical volumes, you must use <strong>lvdisplay<\/strong> to learn how to proceed instead of breaking your system.<\/p>\n<h2>Check Disk Stats For Optimal Performance<\/h2>\n<p>If I tell you that you can learn what is your disk\u2019s 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.<\/p>\n<p>If you do not have <strong>iostat<\/strong> package installed yet then it is time that you should install it.<\/p>\n<pre><strong>$ sudo apt install iostat<\/strong><\/pre>\n<p>Once installed simply run:<\/p>\n<pre><strong>$ iostat -x<\/strong><\/pre>\n<p>It will show you request size as <strong>avgrq-sz<\/strong> which shows how your disk is performing against requests.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"790\" height=\"466\" class=\"wp-image-9346\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-319.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-319.png 790w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-319-300x177.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-319-768x453.png 768w\" sizes=\"auto, (max-width: 790px) 100vw, 790px\" \/><\/p>\n<p>If your disk\u2019s <strong>avgrq-sz<\/strong> is higher than 100.0 then it means it is performing optimally. Otherwise, you will need to improve it.<\/p>\n<h2>Conclusion<\/h2>\n<p>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.<\/p>","protected":false},"excerpt":{"rendered":"<p>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\u2019t know how&hellip;<\/p>","protected":false},"author":1,"featured_media":9436,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[485,100],"class_list":["post-9342","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-linux-file-system","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=9342"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9342\/revisions"}],"predecessor-version":[{"id":9435,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9342\/revisions\/9435"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/9436"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=9342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=9342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=9342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}