Operations 5 min read

Optimizing Linux System for SSD Performance: Filesystem, I/O Scheduler, and Memory Settings

This guide details Linux OS tuning for SSDs, covering ext4 TRIM, noatime, I/O scheduler selection, write cache activation, swap and cache pressure adjustments, tmpfs temporary directories, and Firefox cache relocation to improve performance and longevity.

Qunar Tech Salon
Qunar Tech Salon
Qunar Tech Salon
Optimizing Linux System for SSD Performance: Filesystem, I/O Scheduler, and Memory Settings

1 Principle

Minimize frequent fragmented writes to extend lifespan and enable special settings for performance.

2 OS Configuration

2.1 Enable ext4 TRIM

Enable TRIM (delayed discard) for ext4 by editing /etc/fstab:

/dev/sda1        /                ext4        noatime,discard         0   1

2.2 Add noatime option

Add noatime to /etc/fstab:

/dev/sda1        /                ext4        noatime         1   1

2.3 Use noop I/O scheduler

Set I/O scheduler to noop via boot parameter:

elevator=noop

For LILO, add to /etc/lilo.conf:

append=\"elevator=noop\"

Then run:

sudo lilo

2.4 Enable SSD write cache

Enable write cache:

hdparm -W1 /dev/sda

2.5 Use deadline scheduler after boot

Set deadline as default scheduler:

sudo echo deadline > /sys/block/sda/queue/scheduler && sudo echo 1 > /sys/block/sda/queue/iosched/fifo_batch

2.6 Reduce kernel swap tendency and file cache

Lower swappiness and vfs cache pressure:

echo 0 > /proc/sys/vm/swappiness
 echo 30 > /proc/sys/vm/vfs_cache_pressure

3 Use tmpfs for temporary directories

Mount /tmp and /var/tmp on tmpfs by adding to /etc/fstab:

tmpfs   /tmp   tmpfs   nodev,nosuid,noexec,relatime,mode=1777,size=15%    0    0
 tmpfs   /var/tmp   tmpfs   defaults,size=5%    0  0

Note: Some sources suggest moving /var/log to tmpfs, but the author does not recommend it.

4 Set Firefox temporary files to /dev/shm

Open about:config in Firefox.

Search for browser.cache.disk.parent_directory .

Add the string preference with value /dev/shm .

5 References

HOWTO – Optimize #! statler for use with a solid state drive (Arch Wiki).

Author: He Weiping, Qunar Travel & Vacation Division, search and database researcher.

LinuxSystem AdministrationfilesystemI/O schedulerSSD Optimization
Qunar Tech Salon
Written by

Qunar Tech Salon

Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.