Presentation
To make the life of a SSD longer, there are several rules to follow.
Stop writing a timestamp every time a file is accessed
Edit the /etc/fstab file and replace all the defaults strings by defaults,noatime.
For example:
/dev/mapper/rhel-root / xfs defaults 1 1
becomes:
/dev/mapper/rhel-root / xfs defaults,noatime 1 1
Trim the SSD at boot
For versions before RHEL 7.2, edit the file /etc/rc.d/rc.local and paste the following lines:
/usr/sbin/fstrim / /usr/sbin/fstrim /home /usr/sbin/fstrim /boot
Make the file executable:
# chmod u+x /etc/rc.d/rc.local
Start the associated service:
# systemctl start rc-local
Note1: You don’t need to enable the rc-local service, it’s already done.
Note2: If you don’t regularly reboot your PC, execute the fstrim command through cron or a Systemd timer.
Since RHEL 7.2, a new fstrim service is available.
To make it permanently active, type:
# systemctl enable --now fstrim.timer
Limit swap use
Edit the /etc/sysctl.conf file and paste the following lines:
vm.swappiness=1 vm.vfs_cache_pressure=50
Make the changes active:
# sysctl -p
Use a SSD-friendly I/O scheduler
Edit the /etc/default/grub file and add elevator=deadline at the end of the GRUB_CMDLINE_LINUX variable.
Make the change active:
# grub2-mkconfig -o /boot/grub2/grub.cfg
Note: This can also be done on a per-disk basis (see How to configure I/O scheduler).
Additional Resources
You can also read this article about SSD data recovery and TRIM feature.
Leave a Reply
You must be logged in to post a comment.