RHEL7: Extend the life of a SSD.

Share this link

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).

Source: Taken from JensD’s blog and slightly adapted to RHEL 7.

Additional Resources

You can also read this article about SSD data recovery and TRIM feature.

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 3.00 out of 5)
Loading...

Leave a Reply

Be the First to Comment!

Notify of
wpDiscuz

RHCSA7: Task of the day

Allowed time: 5 minutes.
Create a user account named "tony" with password “redhat” and belonging to a secondary group called “team”.

RHCE7: Task of the day

Allowed time: 10 minutes.
Set up a caching-only DNS server to forward DNS queries.

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...