My Favorites

Close

Please to see your favorites.

  • Bookmark
  • Email Document
  • Printer Friendly
  • Favorite
  • Rating:

Disabling fstrim - under which conditions?

This document (7023805) is provided subject to the disclaimer at the end of this document.

Environment


SUSE Linux Enterprise Server for SAP Applications
SUSE Linux Enterprise Server 12 Service Pack 3 (SLES 12 SP3)
SUSE Linux Enterprise Server 12 Service Pack 4 (SLES 12 SP4)
SUSE Linux Enterprise Server 15
SUSE Linux Enterprise Server 15 Service Pack 1 (SLES 15 SP1)

Situation

fstrim is used on a mounted filesystem to discard (trim) blocks which are not in use by the filesystem.
This is especially useful for solid-state drives, SSDs and thin-provisioned storage.

fstrim is enabled by default and runs weekly, every Monday 00:00:00 (see: 'systemctl list-timers' output).

Some admins prefer to disable it, hence the question: Under which conditions is it okay to disable fstrim, also with reference to SLES SAP HANA.

Resolution

fstrim scans the filesystem and sends 'UNMAP' commands for each unused block it finds.
Consequently fstrim is only needed if:

- the underlying device is thin-provisioned
*and*
- the filesystem doesn't use UNMAP internally

fstrim (or TRIM/DISCARD in general) only makes a difference to a thin-provisioned system if the system itself is over-provisioned.
If the system has allocated enough space for each LUN (thin-provisioned or not) issuing TRIM commands is not required.
However, running SAP HANA on an over-provisioned storage array is not recommend.

Furthermore on SAP HANA systems in DR mode it's strongly advised to NOT use thin provisioned devices.
Thin-provisioning is using an array-wide state and may be ending up in different states on different arrays.
In case of a DR scenario one might be ending up in a situation where one array hits the thin-provisioned limits, whereas the other doesn't. 

Additional Information

1. Disable fstrim:
The fstrim.timer is scheduled to activate the fstrim.service every Monday 00:00:00. fstrim.service then executes '/usr/sbin/fstrim -av'.

To stop/disable fstrim:
systemctl stop fstrim.timer
systemctl disable fstrim.timer
(If needed, 'fstrim' can be run manually: "/usr/sbin/fstrim -v <mountpoint>")


2. In case the 'btrfs' filesystem is in use:
Until SLES12 SP4 the BTRFS_TRIM_PERIOD is also set to "weekly" in /etc/sysconfig/btrfsmaintenance.
The btrfsmaintenance cron job can be disabled by setting BTRFS_TRIM_PERIOD="none".
If there's still too much load on the SAN, it might be necessary to set BTRFS_BALANCE_PERIOD to "none" as well.

On SLE15 BTRFS_TRIM_PERIOD defaults to "none".

(If needed, btrfs-balance and btrfs-trim can be run manually: "sh /usr/share/btrfsmaintenance/btrfs-balance.sh" and "sh /usr/share/btrfsmaintenance/btrfs-trim.sh")


3. Validate whether UNMAP is supported on the filesystem

To validate whether the filesystem supports UNMAP the discard max value reported by 'lsblk -D' can be looked at.
A discard_max_bytes value of 0 means that the device does not support discard functionality.
The same can be achieved by checking sysfs directly:

# cat /sys/block/sda/queue/discard_max_bytes 
0

Another method to check if fstrim/UNMAP is or is not supported on a filesystem is to check the 'fstrim -v' output. If fstrim/UNMAP is not supported:
'fstrim -v /mnt/xzy' will return
'fstrim: /mnt/xyz: the discard operation is not supported'.

If it is supported fstrim will discard unused blocks and report back:
'fstrim -v /mnt/ /mnt: 12.3 Gib (number_of_ bytes) trimmed.


4. For details about "SCSI Unmap support on IBM Spectrum Virtualize systems (including SAN Volume Controller, Storwize V5000, Storwize V7000, and Flashsystem V9000)" have a look at the IBM Support Documentation at: 

Disclaimer

This Support Knowledgebase provides a valuable tool for NetIQ/Novell/SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7023805
  • Creation Date:02-APR-19
  • Modified Date:23-AUG-19
    • NovellSUSE Linux Enterprise Server for SAP Applications
    • SUSESUSE Linux Enterprise Server
< Back to Support Search

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.


SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center