Installing Linux to the SSD

Drive uses electronic memory (SSD — Solid State Drive), light weight, run quietly and consume three times less energy than hard disk drives (HDD). However, the main reason for their popularity is fantastic speed. The operating system is loaded quickly, operations with large files are significantly faster.

The disadvantage of SSDs is the wear and tear of cells. The memory is degraded in the process of overwriting data. The average in 0.5-3 years the drive may fail. In order to extend the life of the drive, use Linux to the SSD must obey certain rules. Some consider this material.

  • Features of SSD
  • How to install Linux on the SSD?
    • 1. Choosing a file system
    • 2. The paging file setting
    • 3. Setup the mount in fstab
    • 4. Setting TRIM
  • Insights

Features of SSD

Classic hard drives (HDD) store data in the magnetic layer. For reading and writing used by positioning the magnetic head. Move the reader requires some time, so the speed of the HDD is limited.

The principle of operation of the SSD based on the use of electronic memory cells. The information unit stores the charge inside the transistor, the reference to the cell executes a controller. Delays when reading from or writing to a minimum.

However, with each overwriting the cell is destroyed and ceases to hold a charge. The controller constantly checks the cell, and rewrites the information in the defective blocks. When free space ends, the drive needs to be replaced.

Engineers successfully work on extending the life of the SSD, but users can also extend the life of the drive, correctly configuring the operating system.

On the Internet there are hundreds of tips issued by the search engines on request “Installing Linux on SSD”, however we suggest you take written with care. Dwell on the moments that contribute to improving the state of SSD storage without the risk of data loss.

How to install Linux on the SSD?

Externally, the installation of the Linux operating system to the SSD looks the same as on a magnetic disk. Only difference between the settings of the file system, the swap partition and mount options sections.

1. Choosing a file system

At this stage, Unix has developed a special file system that is tailored to SSD-drives:

  • Extended4 (ext4) is the most popular and stable file system in this environment enabled disable logging, as well as the TRIM function.
  • BtrFS is a file system developed by Oracle engineers, maintains mirrored copies of the data structures and checksum that allows you to easily recover files if damaged. Logs are not kept, so the additional load on the disk does not occur.
  • XFS is a file system developed by Silicon Graphics to work with large files, logs are kept only for the registration of changes in data structures.
  • Flash-Friendly File System (F2FS) – development of Samsung specifically for flash drives and SSD. Takes into account the wear of memory, collects data in the package, which then writes into the free area in one cycle.

As you can see, the choice is rich, the field for experimentation is wide. However, if you ask, what is the file system on the SSD for Linux will be the best, we will advise to stay on the proven ext4. Other systems continue to be refined, they can be a critical error.

2. The paging file setting

RAM is never too much. If you have less than 4 GB, we recommend you to purchase and install additional straps. In this case, the paging file will require less operating system. Hence a reasonable question: do I need a swap for Linux on the SSD?

When installing the system, we recommend that you create a swap file. In cases where insufficient memory is available, Linux starts to unload to disk, but does not fall. You will have the chance to detect and unload too resource intensive program.

The specifics of the discharge of the memory segments in Linux the swap file is controlled by the parameter swappiness. The default value is 60. The smaller this value is, the stronger must be the overloaded system before starting to flush memory to disk.

In order to check these settings, run Terminal and run the command:

cat /proc/sys/vm/swappiness

In our case, is set by default. In order to change it, you must edit the file /etc/sysctl.conf. Open the file in the editor with the command:

sudo nano /etc/sysctl.conf

Go to the end of the file on the keyboard and press Alt-/, and add the line:

vm.swappiness=5

Close the editor and save changes in the edited file. The new settings will take effect after you restart the operating system.

3. Setup the mount in fstab

After installing Linux to the SSD is completed, it is recommended to change mount options. Feature of Unix is the existence of a special attribute on files — last access time (access time stamp). This attribute is overwritten every time when applying any process to the file. The need of the dubious attribute, and the load on the SSD is significant.

Update attribute, last access time is disabled if to add to the disc mount option noatime. To change settings you must edit the file /etc/fstab. This is a system file, so to edit it you need root access:

sudo nano /etc/fstab

Use the arrows to position the cursor in the position after designating the file system type (ext4) and after a space enter the keyword noatime. After he put a comma. Please note that a space between the comma and the next word should not be.

Changed lines should look like this:

UUID=xxxxxxx / ext4 noatime,errors=remount-ro 0 1

UUID=xxxxxxx /storage ext4 noatime,defaults 0 1

4. Setting TRIM

Setup an SSD in Linux is nearing completion. It remains to consider the TRIM method. As memory cells wear out, the embedded controller in every time and writes the data to new units. When free space is about to end, the disc starts to slow down.

Files in the operating system corrected, overwritten, deleted. The team’s task TRIM (Data Set Management) to inform the SSD controller that certain blocks of data already empty and they can again write down the information.

In Linux TRIM command by default runs once a week. In case of high intensity of computer use not enough, it is advisable to run the optimization more often.

Check out the timer to execute the TRIM command:

systemctl cat fstrim.timer

Make sure in section [Timer] the value for OnCalendar set as weekly (week). In order to add the new setting, run the following commands:

sudo mkdir -v /etc/systemd/system/fstrim.timer.d

Now open the created file using the Nano editor:

sudo nano /etc/systemd/system/fstrim.timer.d/override.conf

Add the following line:

[Timer]
OnCalendar=
OnCalendar=daily

Close the editor and save changes in the edited file. To apply the settings restart the computer or run the command:

sudo systemctl daemon-reload

Make sure that changes to the settings applied by running the command:

systemctl cat fstrim.timer

All right, the TRIM command will now be executed every day.

Insights

SSD is 100 times faster than magnetic disk, but also has its own specific use. The latest version of Windows or Ubuntu take into account the features of the SSD, so can be recommended for use with these devices. In order to install Linux on the SSD, don’t need any special knowledge. The installation wizard will tell you what steps should be done.

The speed of SSD in Linux you can measure using the command:

systemd-analyze

The result of the command will display the system boot time. To extend the lifetime of your SSD with the usual 3-5 up to 10 years newly installed system should be properly configured. No need to follow the tips taken from unverified sources. It is enough to perform the important settings that eliminates the execution of unnecessary write operations to SSD.

Source: losst.ru

(Visited 78 times, 2 visits today)