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.
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 12.2 Add noatime option
Add noatime to /etc/fstab:
/dev/sda1 / ext4 noatime 1 12.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 lilo2.4 Enable SSD write cache
Enable write cache:
hdparm -W1 /dev/sda2.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_batch2.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_pressure3 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 0Note: 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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
