You are Here:
Download Linux Lite 5.6 Final today - See Release Announcements



X Close Ad
X Close Ad
[ HELPFUL TIP ] Fast disk I/O with ext4 HOWTO

Author (Read 11833 times)

0 Members and 9 Guests are viewing this topic.

Fast disk I/O with ext4 HOWTO
« on: June 18, 2018, 11:49:25 AM »
 

kpanic

  • PayPal Supporter
  • Forum Regular
  • *****
  • 162
    Posts
  • Country: fi
  • Reputation: 66
  • Linux Lite Member

  • Linux Lite: 4.0 64bit

  • CPU: Core i5 M450

  • MEMORY: 8Gb

  • VIDEO CARD: Nvidia GT216
We all know, that Linux Lite is very fast Operating System and does not require modern
hardware. To get even more speed out of the system, there are very many tuning possibilities
and one of them is tuning some basic disk input/output operations.

This short HOWTO is for those users who use ext4 filesystem but there are many possibilities
for those users who use other filesystems too and if I have time, I will try to write more later.

One of the easiest ways to get more speed out of your disks is tuning the mount options.
This can be done by editing the /etc/fstab file.
You can see which options are currently in use by commanding (in Terminal window)
Code: [Select]
mount | grep ext4
Not all of the options applied are visible this way but I'm sure you got the idea.

You may try these options first before applying them to the /etc/fstab file.
If you have more than one partitions, for example a separate /boot or /home
partition, then you may as well try using one of them first. For example, let's assume that
you have a separate /home partition in device /dev/sda2. Then you may try this ( and this is SAFE
if you do exactly as I tell here. And use the correct device name and don't make typos :)
(To find out which device name is your /home, just examine the output of that 'mount | grep ext4'  command).

First enter a root session, so that you don't have to type 'sudo' all the time. So, command:
Code: [Select]
sudo su
Then unmount the /home partition ( if it is /dev/sda2 ) by commanding:
Code: [Select]
umount /dev/sda2
And now the speed-UP!
Code: [Select]
mount -t ext4 -o defaults,noiversion,auto_da_alloc,noatime,\
errors=remount-ro,commit=20,inode_readahead_blks=32,delalloc,barrier=0 /dev/sda2 /home

Note that I could not write the whole command to just one line, so there is a '\' character, which tells the shell,
that the command will continue on the next line.

If everything went fine and you did not receive any messages, you may check the dmesg output like this:
Code: [Select]
dmesg | tail -4and you should see the filesystem driver's message about this mount.

To mount your /home back with the defaults, command:
Code: [Select]
umount /home && mount /home 2>&1
Of course this did not demonstrate how it actually speeds up reading and writing to disk but you may take time
to copy your /home full of files using the default mount options and the tuned options if you like to.
However these kinds of tunings show their full power just when they are applied to everyday use and especially
to the / partition - since the root partition is read and written most of the time.

Please don't expect too much, this (and similar methods) won't turn your ol'PC to a super-computer :)
But you may see some difference after using the system for a while.

To apply these settings to your /etc/fstab, you need to edit that file and I suggest that you create a backup
copy of the file first:
Code: [Select]
cp /etc/fstab /etc/fstab.bak(and why not take a copy of it into a USB stick too...)

Then open your /etc/fstab with a text editor (nano /etc/fstab) and replace the old options, which are between
the text 'ext4' and the two numbers in the end. Here is an example from my /etc/fstab
(The / partition entry)
# / was on /dev/sda2 during installation
UUID=1e6ae380-25c3-40dc-b7ea-39d82488615a  /  ext4
Code: [Select]
defaults,noiversion,auto_da_alloc,acl,user_xattr,noatime,errors=remount-ro,commit=20,inode_readahead_blks=64,delalloc 0  1

DO NOT APPLY these options into any others entries than ext4 !!
(Other filesystems have other mount options).

And every entry must remain in ONE line!
Lines beginning with a '#' character don't matter. You may write anything on those lines.

Again, it is just one line, but it broke to many when I wrote it here...
But as you see, the mount options are between the text 'ext4' and the two numbers in the end of the line.

When these options are written to the fstab file, they won't take effect until the filesystem is unmounted
and remounted again (or just remounted or just rebooted the computer).

WARNING: I cannot take responsibility of any data loss or similar. This small HOWTO is written for
those, who either have just made a fresh installation of Linux Lite and want to try this without loosing
more than maybe a new fresh installation. Or for those who can take responsibility of their own typos
and/or other mistakes.

These are everyday actions for system administrators and there is no 'magic' involved.
And by the way, nothing is free when it comes to performance and/or memory usage.
These mount options may use a bit more RAM memory but as you know, RAM is much faster
than disk - so in my opinion it is a fair deal if there is some extra RAM which just sits there unused
during everyday use of the computer.

Have fun - and please ask if you have questions..
Last Edit: June 18, 2018, 12:51:21 PM by kpanic
 


Re: Fast disk I/O with ext4 HOWTO
« Reply #1 on: June 19, 2018, 12:15:23 PM »
 

Moltke

  • Platinum Level Poster
  • **********
  • 1033
    Posts
  • Country: ve
  • Reputation: 120
  • Linux Lite Member

  • Linux Lite: 5.0 64bit

  • CPU: amd athlon 64 x2

  • MEMORY: 4Gb

  • VIDEO CARD: amd radeon hd 6750

  • Kernel: 5.x
Hi @kpanic

First of all, very nice post! :) I have a couple of questions; first, did you try this with a hdd or a ssd? Will this work in a hdd or a usb hdd? I guess it should but I thought of asking anyway. Thanks!
Without each others help there ain't no hope for us :)
Need a translation service? https://www.deepl.com/es/translator
 

Re: Fast disk I/O with ext4 HOWTO
« Reply #2 on: June 19, 2018, 08:50:24 PM »
 

kpanic

  • PayPal Supporter
  • Forum Regular
  • *****
  • 162
    Posts
  • Country: fi
  • Reputation: 66
  • Linux Lite Member

  • Linux Lite: 4.0 64bit

  • CPU: Core i5 M450

  • MEMORY: 8Gb

  • VIDEO CARD: Nvidia GT216
@Moltke , thanks!

I use these options with both hdd and ssd, except that with ssd, I use option 'discard' also, so that trim is enabled.

Works with USB too, so you can test with one first :)
 


Tags:
 

X Close Ad
X Close Ad

Download Linux Lite 5.6 Final today - See Release Announcements