Solid State Drive- Linux

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

The Swappiness Page

Applicable modified excerpts from the article: SSD: how to optimize your Solid State Drive for Linux Mint 18.x by ??? on Easy Linux tips project. This is an excellent guide.

This is an adapted and truncated version applicable to Mint Linux 18 and most probably Ubuntu, Kubuntu, Mint, and other Debian derivatives.

Avoid quick wear: reduce write actions

Seven percent with a maximum of 10 GB of the drive should be left unpartitioned or unallocated as this seems to have a proven relation to SSD drive longevity. I used the quick install, then went back in with parted and resized.

The best file system (formatting) for an SSD, is the usual default EXT4.

With "noatime" in /etc/fstab, you disable the write action "access time stamp", that the operating system puts on a file whenever it's being read by the operating system. For an SSD "noatime" is much better.

sudo vi /etc/fstab

Now add the word noatime to the line for your root partition and your other Linux partitions, just before errors=remount-ro. Note: don't add it to the line for the swap partition!

/dev/mapper/mint--vg-root /               ext4    noatime,errors=remount-ro 0       1

On some newer versions of mint they are mounting by UUID. For UUID Mounted Partitions see this example:

# / was on /dev/sda2 during installation
UUID=e0b539aa-3f95-4455-92eb-e2c6326ec30a /               ext4    noatime,errors=remount-ro 0   1

update 2023 in regards to noatime: noatime doesn't make a big difference with modern SSDs however it does no harm to add this parameter.

Limit swap wear

Check your current swappiness setting. Type in the terminal (use copy/paste):

cat /proc/sys/vm/swappiness

The result will probably be 60. - way to high for SSD and too high for a typical desktop workstation.

b. Now type in the terminal (use copy/paste):

sudo vi /etc/sysctl.conf

Add the following line at the end

vm.swappiness=1

Note: some sources say that 25 is a recommended setting for modern SSDs. I am going to start using 10.

vm.swappiness=10


Next, lets talk about TRIM:

  • What is trim?
  • increase trim schedule
  • manually execute trim (what I do)

(1) TRIM/UNMAP is supported for SSDs, for dataset management and to improve SMR performance over time. One of the shingled write benefits is that all physical sectors are written sequentially in a direction radially and are only rewritten after a wrap-around. Rewriting a previously written LBA (Logical Block Addressing) will cause the previous write to be marked invalid and the LBA will be written to the next sequential physical sector. The TRIM/UNMAP enables the OS to inform the drive which blocks are no longer considered to be in use and can be reclaimed internally by the HDD to ensure that later write operations perform at full speed.

(2) It is often suggested to change weekly trim cleaning to daily for SSDs. I don't think it is worth the hassle.

(3) If you're a proactive sort of guy that feels he must do every little thing to increase performance, you can manually execute trim cleaning from the CLI. Execute TRIM on all mounted partitions that support it:

sudo fstrim -av

Warning: on a few SSD models executing a manual fstrim command when there's high disk activity (I/O activity), might cause problems.

Web Browsers

Chrome and Firefox have features that cause a lot of i/o and specifically write activity to your SSD. Look up how to disable sessionstore on Firefox and with Chrome disable cookie site data reloading.

Defrag

DO NOT defrag. This is more of a Microsoft Windows thing than a linux thing but is worth mentioning here especially if you dual book with a M$ partition.



References