Penguin Crumbs

Notes and tips from a Linux user

home about this blog

Hard disk optimizations

Access time and data writing time are critical factors and very often affect significantly the user experience. In this post I would like to share a couple of optimization tricks about using hard disk partitions with Linux: using these tricks you can increase read/write performance on slow partitions (anyway, don't expect much).

1. tuning disk writes in /ets/fstab

Usually Linux updates the access time in files and directories whenever you read a file or a directory content. To avoid this (maybe) useless feature, try to use "relatime" mount option in /etc/fstab. It means that the access time will be updated only if the previous access time was earlier than the modify time or if the previous access time was more than 24 hours old.

In the same configuration file you can also play with write cache to reduce the amount of writes. The "commit" parameter will set the timeout for disk sync. (The default value is 5. It means that if your PC loses the power, it will lose as much as the latest 5 seconds of work.)


/dev/sda1 /opt ext4 defaults,relatime,nofail,commit=59 0 2

2. increase read performance with preload module

Preload daemon can easily speed up the startup time of applications. In Ubuntu and Debian, just install the package with

sudo apt install preload

When the system load is low it will read files used by more frequently-used programs and will keep the files preloaded in memory. And since it uses the Linux read cache, it does not need an excessive use of memory, which can be easily and quickly freed by the operating system as needed.

Posted on 2021-11-21  
⇦  back
Copyright © 2019-2024 Marcello Zaniboni