How to optimize ssd in linux step by step
Table of contents:
- Optimizing an SSD in Linux
- Basics of an SSD
- Main Settings for Optimizing an SSD
- Avoiding access times
- TRIM activation
- Tmpfs
- Changing IO Schedulers
- Rebooting
- Conclusions
There are several reasons for optimizing a SSD in Linux. For example, buy an SSD hard drive and want to get more out of it, and have it but want to make it go faster, want to extend the life of our SSD. Anyway, whatever your case, here we will explain how to do it.
Index of contents
Optimizing an SSD in Linux
Basics of an SSD
SSD is the term used to refer to the new generation of storage units for computers. It is the acronym for the English "Solid State Drive" equivalent to the Spanish Solid State Drive.
The main advantages of a solid hard disk in contrast to a conventional hard disk, basically derive from the fact that its operation is not based on the use of constantly moving mechanical components. Which is reflected in a high reading speed. This difference is palpable especially at system startup and when running programs that require high processing capacity.
Main Settings for Optimizing an SSD
Now that we are clear about what an SSD is, let's get down to business with the settings for optimizing an SSD. There are a lot of tweaks and optimizations that are recommended when updating an SSD. However, after evaluating and filtering everything that is said regarding the subject, we made a list of essential adjustments.
Several tasks on this list involve the fstab file, so our first recommendation is to back it up first. You can use the following command:
sudo cp / etc / fstab /etc/fstab.bak
In this way, if something goes wrong, you can delete the file and restore the original backed up file.
Avoiding access times
This is essential to increase the life of our SSD. It is simple, we reduce the amount of writes it performs on the Operating System to disk. In case you need to know the moment when I made your last access to a directory or file, we add in the / etc / fstab file , these two options:
noatime nodiratime
NOTE: they must be with the rest of the options, and their specification separated by commas (,) and not by spaces.
TRIM activation
Activating TRIM is useful to help manage disk performance in the long term. To do this, the following option is added to the fstab:
discard
It should be noted that this works perfectly well with ext4 file systems, and even with normal hard drives.Also, although it is true that initially it does not represent an improvement in performance instantly, in the long term it should make the system work much better. That is why we have included it in our list.
Tmpfs
By default, the system saves its cache in / tmp. Knowing this, we can configure through fstab that the cache be mounted in RAM as a temporary file of the system, in this way the system will touch the hard disk as little as possible. To do this, we add the following line to the end of / etc / fstab:
tmpfs / tmp tmpfs defaults, noatime, mode = 1777 0 0
We save the changes to the file to proceed.
Changing IO Schedulers
The system does not write the changes directly to the hard disk, but rather queues the different requests. It is the input-output scheduler that handles this properly. By default the scheduler is cfq, however we can change this one for one that best suits our new hardware.
For this we have to carry out the following steps:
WE RECOMMEND YOU CPU Delid: What it is and what it is forFirst, we list the options available to choose planner with the following command:
cat / sys / block / sd X / queue / scheduler
Where the X, you must replace it with the letter of the corresponding unit of your system.
If you have the deadline option it is the one you should use, since it allows other extra adjustments later. If not, another option could be noop. Now we must specify the operating system to use these default options at each startup, for this we edit the rc.local file:
sudo nano /etc/rc.local
Note: For the purposes of this case, we use the nano editor, but you can use the one of your preference.
Before the line "exit 0", you add these two lines (if you are using deadline):
echo deadline> / sys / block / sdX / queue / scheduler echo 1> / sys / block / sdX / queue / iosched / fifo_batch
Or, in case you are using noop, you add this line:
echo noop> / sys / block / sdX / queue / scheduler
Again, the X must be replaced with the letter of the corresponding drive in your system.
Verify that everything is correct, save and then exit your editor.
Rebooting
A restart is required for all of these changes to take effect. After the restart, everything should be ready. If for some reason something went wrong and you cannot start your system, you can undo the changes and try again step by step described.
Changes to the fstab file will be kept indefinitely at installation, even tolerating updates. However, the rc.local file must be restored after every update of your version.
Conclusions
As you can see, there is no greater complexity in these steps to perform the optimization of an SSD. Best of all, we will achieve a 100% improvement which translates into infinite improvements in what are boot times, transfer, write and load data.
We recommend reading how to optimize SSD in Windows 10.
Tell us what other adjustment you have made on your SSD or write to us with any concerns?
How to mount an ssd on a laptop step by step
Guide on how to mount an SSD mount on a laptop using a caddy or replacing the internal hard drive of the computer. a quick and very easy guide to make
▷ How to start safe mode windows 10 【step by step】 【step by step】
If you want to know how you can enter Windows 10 safe mode ✅ in this tutorial we show you all the possible ways to access it.
▷ How to install kali linux in virtualbox and configure it step by step
If you want to know how to install Kali Linux in VirtualBox and configure the Wi-Fi network card ✅ visit our article where we explain everything